php / mysql query
Posted: Thu Jan 22, 2009 3:41 pm
I am currently coding a GCSE project in PHP. I had already coded this before, and it DEFINITELY worked. I may have updated to a new PHP version(I use WAMP and had downloaded a new version). Anyway, I was testing my old code and it wasn't working. No error codes were returned via So I decided to insert untill I found the code which was 'broken'. After locating this code I changed to and finally it talked to me.
I have fixed the problem in the code now, but could someone please tell me what was wrong with this code(which use to work):
AND this code which now works.
Oh and no flaming my code
I'm new to PHP, my second program.
Cheers,
Mkay
Code: Select all
or die(mysql_error())Code: Select all
echo hi;Code: Select all
or die(mysql_error())Code: Select all
or die(NO IDEA)I have fixed the problem in the code now, but could someone please tell me what was wrong with this code(which use to work):
Code: Select all
// Checks if user has already registered a match
$warlistedquery = mysql_query("SELECT warlisted FROM users WHERE username='$username'") or die(mysql_error());
$warlisted_fetch = mysql_fetch_array($warlistedquery) or die(mysql_error());
$warlisted = $warlisted_fetch['warlisted'] or die('NO IDEA');
if ($warlisted =='1')
{
die('You have already listed a war, delete it via control pannel to list a new war');
}Code: Select all
$warlistedquery = mysql_query("SELECT warlisted FROM users WHERE username='$username'") or die(mysql_error());
$warlisted_fetch = mysql_fetch_array($warlistedquery) or die(mysql_error());
if ($warlisted_fetch['warlisted'] =='1')
{
die('You have already listed a war, delete it via control pannel to list a new war');
}Cheers,
Mkay