Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Php MySql problem


ghost's Avatar
0 0

okay, so i had a file accessing my mysql db and i moved it to a subdirectory, and suddenly it cant query the table….gets no return. i move it back, and it works again…. any idea whats wrong?


ghost's Avatar
0 0

i wouldnt have thought that was a sql problem. check through the code see if theres anything directory related?


ghost's Avatar
0 0

$con = mysql_connect("localhost","userhere","passhere"); mysql_select_db("db",$con); $result = mysql_query("SELECT * FROM table WHERE item='" . $item . "'"); $row = mysql_fetch_array($result);

okay….so that code is obviously removed all the database info…but i assure you it works, or did in the root dir (public_html), but in the subdir….no dice


ghost's Avatar
0 0

hmm :/ ive never had that problem before… does all your mysql stuff have that problem?


ghost's Avatar
0 0

nope only in that one subdir. i literally copied this file from root to here…and BAM! problem heres the error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/samurain/public_html/place/file.php on line 7


ghost's Avatar
0 0

thats just odd. maybe you didnt notice a lil bit of code that was wrong?


ghost's Avatar
0 0

yea. but its odd that it would work in one place but not another


ghost's Avatar
0 0

fixed yet?


ghost's Avatar
0 0

neg…still working at it


Mr_Cheese's Avatar
0 1

does the script have any includes / requires in it?

if so, i'd guess that as you move directories you dont compensate the rinclude/requires locations.


ghost's Avatar
0 0

exactly what i was saying lol


ghost's Avatar
0 0

nah none…..the only line of code before that is <?php


ghost's Avatar
0 0

alright. got it