Hot answers tagged

6 votes
Accepted

Pset7 missing mysql sock

I'm sorry if it's not appropriate to answer your own question but I'd like to post the solution to this problem just in case someone has the same issue. The commands sudo /etc/init.d/mysql start ...
Gabriel's user avatar
  • 97
3 votes

phpMyAdmin: "mysql extension missing" error

We all know that phpMyAdmin can be flaky sometimes. Unfortunately, I can't tell you how to fix it -- but I can tell you how to use mysql50 shell from the command line. Try stuff like this: mysql50 ...
hotwebmatter's user avatar
  • 3,050
3 votes
Accepted

What is wrong with this SQL command?

As I told you on Slack: This is the syntax that will work: "INSERT INTO table(field1,field2,field3) VALUES (?,?,?)", $var1, $var2, $var3); and replacing the fields and variables as appropriate.
curiouskiwi's user avatar
  • 18.6k
2 votes
Accepted

(pset8) Search.php FULLTEXT minimum character length

I'm not so sure you should create distinctive indexes for each column. What I did was to create a FULLTEXT index for 3 columns together, and then search using that. If you want to create different ...
ChrisG's user avatar
  • 7,366
2 votes
Accepted

How to change mysql minimum-character length

This post sounds like it might be what you are looking for Match TWO letters with SQL query… cd to /etc/mysql/conf.d and create a file with extension .cnf (e.g. user_sett.cnf) that looks like this:...
DinoCoderSaurus's user avatar
2 votes
Accepted

Why can't I make this table? It shows an error

The problem looks like you are trying to create a table with two primary keys, one on column ID and one on column TIMESTAMP. A table is only allowed to have one primary key. You can have multiple keys,...
Cliff B's user avatar
  • 68.1k
2 votes
Accepted

Pset 8 Error CS50 Library SQL (CS50 IDE)

it appears that you're using a database user called TODO instead of the one that you should be using. recall that you need to specify these settings in a file called config.json!
kzidane's user avatar
  • 17.6k
1 vote
Accepted

Looking at the course, could I use PDO instead of mysql?

as you reach pset7, the first pset that you are going to interact with a database in it, you won't have to write your own code to connect with your database. instead, there is a query function ...
kzidane's user avatar
  • 17.6k
1 vote
Accepted

Pset7 (Movies) 12.sql: Table outputs 96 rows rather than 5 rows

Using a previous post on this forum, I was able to deduce I had to use the INTERSECT operator, which instantly solves the problem.
qwert9988's user avatar
1 vote

Where is the syntax error in this sql file?

Unless I'm missing something, that is not a sql query. A sql query is something like "SELECT columns FROM table WHERE condition". That is html code.
DinoCoderSaurus's user avatar
1 vote

Locked out of phymyadmin

This seems to have resolved itself by restarting the development environment.
Samuel Oscar Frances's user avatar
1 vote
Accepted

Duplicate entry Error when inserting into portfolios pset7

OK... looks like there is a quick fix this that it was not implicit in the description. By adding ALTER TABLE yourtablename ADD CONSTRAINT uq_yourtablename UNIQUE(column1, column2); it seems that the ...
JaviMar's user avatar
  • 25
1 vote
Accepted

pset7: query(INSERT) return value?

You are not calling PHP mysql_query(). You are calling CS50::query. From the pset specification/instructions: If query is instead passed a DELETE, INSERT, or UPDATE statement, it will return a non-...
DinoCoderSaurus's user avatar
1 vote
Accepted

How to make search.php return results that are more relevant

It's as simple as turning this and obviously I would prefer "Cincinnati, OH" to be the first result. into computer code :) Kinda moves into the realm of computer learning/intelligence. First ...
DinoCoderSaurus's user avatar
1 vote

pset7 problem with buy and portfolios table

Without seeing the details of your user table, or knowing if you have any foreign keys to that table, I can't be sure, but I'm fairly confident that your problem is in your primary key. I'm guessing ...
Cliff B's user avatar
  • 68.1k
1 vote

How should I connect to the multiple databases?

Admittedly I don't fully grasp what you mean "merge several psets". However,in the narrow and specific context of CS50 pset7 & pset8, you do not need two databases. Consider adding the places ...
DinoCoderSaurus's user avatar
1 vote
Accepted

MySQL Query function not working

$username is blank as per the error message: Access denied for user ''@'localhost'..... . There is nothing between the two ticks (single quotes) after user. That makes $password, $dbname suspect as ...
DinoCoderSaurus's user avatar
1 vote

Printing from SQL in PHP

recall that, assuming the query is syntactically correct, query returns an array of the resulting rows (if any) or an empty array otherwise. try print_r'ing $comment to learn about the structure of ...
kzidane's user avatar
  • 17.6k
1 vote

I can't access my table in phpMyadmin

I had this same problem and did find a resolution. After trying numerous suggestions and trying to recreate missing tables, it just went from one problem to another, without ever getting to a ...
Cliff B's user avatar
  • 68.1k
1 vote

SQL Order results by score, desc

Never mind, got it. It is SELECT * FROM users ORDER BY score DESC
i_am_david's user avatar
  • 1,211
1 vote

Accessing information from PHPmyadmin using Javscript

This is the answer from Kareem's link. Please do not vote on this. I just want to take this answered question out of the unanswered list. There are actually several approaches to do this. Some ...
i_am_david's user avatar
  • 1,211

Only top scored, non community-wiki answers of a minimum length are eligible