sylesia Posted December 6, 2006 Share Posted December 6, 2006 Ok, so I am working on code and currently have it in a .html file, and includes some php that accessess a database. Unfortunately I need to really add some fun here with if else statements and such that extend thru the html and incorporate them in. In another words, I need to change my .html to .php but it seems to have issues. I have no problem running it as .html, works fine, accesses the DB, and everything, but when I simply change it to .php, I start to get errors, includingWarning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\Program Files\xampp\htdocs\srh\Junk\cadetyellowedit.php on line 6361 $request = "SELECT $try FROM yellowcard WHERE UserName = '$userName' AND CardNumber = $cardNumber";62 $eval = mysql_query($request, $conn); 63 while($row = mysql_fetch_assoc($eval)){64 $$try = $row[$try]."\n";65 }any ideas why it will not work as .php but does as .html Link to comment https://forums.phpfreaks.com/topic/29595-html-to-php/ Share on other sites More sharing options...
fert Posted December 6, 2006 Share Posted December 6, 2006 that error means your query isn't working Link to comment https://forums.phpfreaks.com/topic/29595-html-to-php/#findComment-135806 Share on other sites More sharing options...
marcus Posted December 6, 2006 Share Posted December 6, 2006 [code]$eval = mysql_query($request, $conn) or die(mysql_error());[/code]do you get any errors, try with the die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/29595-html-to-php/#findComment-135807 Share on other sites More sharing options...
sylesia Posted December 6, 2006 Author Share Posted December 6, 2006 The thing I cannot figure out is why its not working. It works fine if the file has a .html extension, works perfectly, but as soon as I change it to .php and no other changes, than it comes with that error. If I add in the or die statement, I getYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1Again, that only occurs if it is a .php and not .html extension Link to comment https://forums.phpfreaks.com/topic/29595-html-to-php/#findComment-135953 Share on other sites More sharing options...
JasonLewis Posted December 6, 2006 Share Posted December 6, 2006 that is saying that your are checking for a blank variable. try checking $userName has anything and... oh!change:[code=php:0]$request = "SELECT $try FROM yellowcard WHERE UserName = '$userName' AND CardNumber = $cardNumber";[/code]to:[code=php:0]$request = "SELECT $try FROM `yellowcard` WHERE `UserName`= '$userName' AND `CardNumber`='$cardNumber'";[/code]notice how i added the ' and ' around $cardNumber. but also check if both variables contain data. Link to comment https://forums.phpfreaks.com/topic/29595-html-to-php/#findComment-135975 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.