Questions tagged [mysql]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
218 views

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

I've been stuck on this for quite some time and did a lot of research on the AND operator in SQL, but no matter how many variations I try I cannot get my table to output just 6 rows, with each row ...
0
votes
1answer
821 views

MySQL - AttributeError: 'NoneType' object has no attribute '_instantiate_plugins'

I'm trying to run the list.py on my windows, but I'm getting the following error Traceback (most recent call last): File "list.py", line 9, in engine = create_engine(os.getenv("mysql+...
0
votes
1answer
415 views

PSET7 - Register returns 'RuntimeError: no such table...'

I've implemented everything and register worked fine at first but now I'm getting stuck with a RuntimeError: no such table: Porfolio [SQL: 'SELECT * FROM Porfolio WHERE id = 1']. Any help in how to ...
0
votes
1answer
1k views

Editable html table (PHP, MySQL) - doesn't save changes in database

For my final project, i'm trying to make my html tables editable by users, with updating data in MySQL. I've found in web a few js scripts for such case but no one works as needed. My result - ...
0
votes
1answer
473 views

SQL Query showing as undefined

I have a database and I want to count the number of times a state shows up in it. I wanted to use this number later for calculations. However, when I try to do something like this (which correctly ...
0
votes
1answer
454 views

CS50 Finance - How to add to cash

I want to make it so the user can essentially add $10,000 to their current balance. To do this, I made a user with id 26 that has $10,000. I want to add user26's funds to the current user's funds to ...
0
votes
2answers
105 views

Where is the syntax error in this sql file?

After reading several sources I'm not able to find it. Can anybody help me?
0
votes
1answer
34 views

query always fails to execute in php

I am trying to insert student exam answers to a table online_exam_marks. I stored $_POST values after ensuring that $_POST value is not empty and if they empty I just set it to $a = '0' to different ...
0
votes
1answer
59 views

weird fatal error in sell

I am trying to update my history table using the below query: // update history table CS50::query("INSERT INTO history (user_id,sold,sold_number,selling_price,date) VALUES(?,?,?,?,NOW() )",$_SESSION[...
1
vote
1answer
46 views

Locked out of phymyadmin

During pset7, I have somehow accidentally changed my password in for phpmyadmin, and now I'm locked out. Can anyone tell me how to reset this?
1
vote
1answer
93 views

Duplicate entry Error when inserting into portfolios pset7

I am having an issue when inserting a symbol more than once into the portfolio table. I followed pset7 directions making both user_id and symbol as unique: A neat way to impose this restriction ...
0
votes
1answer
65 views

Unable to manually insert rows in Portfolio table

Working on sell.php now. Trying out Sell, I naturally find the need to replenish shares of some stock after selling, for testing purposes. When I try to manually insert, like instructions said to do ...
1
vote
1answer
490 views

phpMyAdmin: "mysql extension missing" error

pset7: I receive the following error when trying to open phpMyAdmin: "the mysqli extension is missing. Please check your PHP configuration. See our documentation for more information." I previously ...
0
votes
1answer
274 views

pset7: query(INSERT) return value?

According to PHP documentation, the following is true about the query(INSERT) statement: For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, mysql_query() returns TRUE on success ...
0
votes
1answer
231 views

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

For pset8 in search.php, I cannot get relevant results to show up. I am using match () against () and I really want to only use this. The problem is, for example, when I type in Cincinnati, I get ...
0
votes
1answer
791 views

pset7 problem with buy and portfolios table

Hello again! I have a problem concerning my buy.php code. The whole site is ready to launch but I keep having a problem with this particular bug, that I seem to fix every time but it keeps coming ...
0
votes
1answer
81 views

How should I connect to the multiple databases?

I am trying to Merge several psets. But to do that I think I need to have multiple databases. My dumbest approach to that problem follows like this in constants.php define("DATABASE", "pset7"); ...
0
votes
1answer
52 views

MySQL Query function not working

I tried writing my own function for my final project, but I always get this: Warning: mysql_real_escape_string(): Access denied for user ''@'localhost' (using password: NO) in /home/ubuntu/workspace/...
0
votes
1answer
375 views

Pset 8 Error CS50 Library SQL (CS50 IDE)

When I execute import I get this error PHP Fatal error: SQLSTATE[HY000] [1045] Access denied for user 'TODO'@'localhost' (using password: YES) in /home/ubuntu/workspace/pset8/vendor/library50-php-5/...
0
votes
1answer
28 views

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

Ok so I haven't enrolled or anything yet, but the course really interests me. I wanted to know if I could use PDO instead of mysql when interacting with the database in PHP? I have a lot of self-...
1
vote
1answer
139 views

Pset7 missing mysql sock

I've followed all the instructions, however if I try to log in or try to access phpMyAdmin I receive an error that says "#2002 - Can't connect to local MySQL server through socket '/var/run/mysqld/...
1
vote
3answers
157 views

Excel into MySQL

A website has a link to download an excel file. I need some of those columns in my MySQL database. Is there a relatively painless way to: 1. use phpmyadmin's import tab 2. use a method similar to ...
0
votes
1answer
40 views

Printing from SQL in PHP

I am trying to print text I have placed into a MySql database. I have been able to insert into the database, but I don't know what to put to take out the value/text <?php require("../includes/...
0
votes
1answer
443 views

How to change mysql minimum-character length

For pset8's search function I would like to change the min-char length used by MATCH AGAINST to 3. I found this link on dev.mysql.com which explains how to change the min_word_len system variable: [...
3
votes
0answers
359 views

Match TWO letters with SQL query [closed]

This is not really a question but I was struggling to match two letter words using MATCH AGAINST and other people might find this useful. MySQL is configured to take only words with a minimum length ...
0
votes
1answer
121 views

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

The error message is probably wrong. I can't see any mistake where it mentions there is one.
0
votes
1answer
292 views

What is wrong with this SQL command?

query("INSERT INTO stocks (id, symbol, shares) VALUES($_SESSION["id"], $_POST["symbol"], $_POST["number"]) ON DUPLICATE KEY UPDATE shares = shares + VALUES(shares)"); I am getting this error Parse ...
0
votes
2answers
188 views

pset7: query problem

When I try these with query function it is giving me an error: query("SELECT * FROM users WHERE username LIKE %?%", $_POST['username']); query("SELECT * FROM users WHERE username LIKE '%?%'", $_POST['...
0
votes
3answers
273 views

I can't access my table in phpMyadmin

I can't access anything in my table due to this error. I have read several solutions before I ask this question and I did try them but nothing worked out so please can you tell me another procedure ...
0
votes
1answer
57 views

SQL Order results by score, desc

What SQL query do I have to run to get all of the rows from a table, ordered from highest score to lowest score? I tried a few different queries, none worked. Thanks, David
0
votes
0answers
380 views

PHP Fatal error: Column count doesn't match value count at row 1

for pset8 , i want to insert places,like this, while ($data=fgetcsv($file,0,"\t")) { //"\t" is string includes only one character // echo $data[3]."\n"; $result=query("INSERT INTO ...
1
vote
1answer
1k views

(pset8) Search.php FULLTEXT minimum character length

Is there a way to alter the minimum character count using FULLTEXT indices in the places table for the mashup database? Adding a FULLTEXT index to the admin_code1 column, which holds abbreviations for ...
1
vote
1answer
36 views

Mysterious MySQL changes

Is there a logfile for MySQL that shows all SQL queries that has been done? I'm having this strange issue where all the funds in my C$50 Finance implementation is being deleted. Would help ...
0
votes
1answer
136 views

Setting up a connection between php and mysql outside of CS50 Appliance using the methods of CS50 Finance?

I recently decided to get my final project from last year online. But I ran into a lot of trouble. Can someone help me? I was using the functions in last year's CS50 finance to connect php to mysql db,...
0
votes
1answer
208 views

pset7 unknown column in where clause

This throws an error saying YHOO is an unknown column...I thought 'symbol' was the column name in this query? $id = 6; $symbol = "YHOO"; $shares_query = query("SELECT shares FROM portfolio WHERE id = ...
0
votes
1answer
265 views

The code given in cs50 doesn t work

I have been working a long time in buy.php and everything works but if I buy the same stock (AAPL) twice it insert a new row into table despite they have de same id, and symbol. //...
1
vote
1answer
1k views

How do I check if an email adress is already used in mySQL?

So I'm working on my registration process of pset7. What's the best way to make sure that an e-mail address can only be used for one account? In my php controller I use this sql query to check if ...
4
votes
1answer
3k views

Accessing information from PHPmyadmin using Javscript

I am currently working on my final project and trying to add markers to my Google map using information from a MySQL table. I called this table ideas and the table contains info such as the longitude ...
1
vote
1answer
273 views

Foreign key constraint error when linking ID to users table

In pset 7 I need to connect the ID from my table to the ID in users. But when I try to insert rows into my table I get the following error: SQL query: INSERT INTO `pset7`.`table` ( `id`, `...
1
vote
1answer
940 views

Unknown column cash php?

When I try to test register.php for pset7, the website says that there is an unknown column cash in the error. Can anyone see what is my mistake? Here is the part of my coding with this error: $rows =...
1
vote
1answer
81 views

Pagination using mysql and php

Are there any MySQL queries that can help me retrieve x recent entries from a table having z total rows such that I can keep a take-off point y, where 0 <= x <= y <= z? Actually its for ...