RottNKorpse
Technical User
- Aug 8, 2006
- 13
I have been staring at just a few lines of code for over an hour and I don't see a single thing wrong with it so I wanted to get some new eyes looking at this to possibly shine some light on the issue.
What I am wanting to do is simply fetch a single value from a table in my database, a table that only has 1 row and 4 columns. Then to insert that data into a variable and call the variable later in the file.
The problem is for some reason when I call for the data it doesn't retrieve anything.
All of the variables for connecting to the database and the prefix are stored in a separate file and they are pulled from that file with no issue. I've even tested to see if it is even looking for the table correctly and it is because I deleted the table which caused it to tell me it didn't exist so I recreated it and still the same empty result.
Here is my MySQL structure
That's it, nothing special in either the code or the table yet it still refuses to pull the data...any idea what it could be?
Thanks in advance
What I am wanting to do is simply fetch a single value from a table in my database, a table that only has 1 row and 4 columns. Then to insert that data into a variable and call the variable later in the file.
The problem is for some reason when I call for the data it doesn't retrieve anything.
Code:
// Database Connection
$dbcnx = @mysql_connect("$dbhost","$dbuname","$dbpass");
$dbselect = @mysql_select_db("$dbname");
if ((!$dbcnx) || (!$dbselect)) { echo "Can't connect to database"; }
// Fetching data from MySQL
$order_sql = @mysql_fetch_row(mysql_query("SELECT * FROM ".$prefix."_table") or die('Query failed: ' . mysql_error()));
$order = $order_sql['order'];
echo $order;
All of the variables for connecting to the database and the prefix are stored in a separate file and they are pulled from that file with no issue. I've even tested to see if it is even looking for the table correctly and it is because I deleted the table which caused it to tell me it didn't exist so I recreated it and still the same empty result.
Here is my MySQL structure
4 Columns & 1 Row
order - field2 - field3 - field4
manual - 0 - 0 - 0
That's it, nothing special in either the code or the table yet it still refuses to pull the data...any idea what it could be?
Thanks in advance