Jump to content

Select query with 2 conditions


mrt003003

Recommended Posts

Hello, Im trying to write a select query that has two conditions. First the playername is = username and second shipyard = 1 I keep getting a parse error: Parse error: syntax error, unexpected ',' in C:\wamp\www\SWB\planet1.php on line 85

 

Heres the code:

 

$tester = "1";
$colname_Planet1 = "-1";
if (isset($_SESSION['MM_Username'])) {
  $colname_Planet1 = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
}
mysql_select_db($database_swb, $swb);
$query_Planet1 = ("SELECT * FROM planet WHERE ShipYard = %s AND PlayerName = %s",  GetSQLValueString($tester, "int"),GetSQLValueString($colname_Planet1, "text"));
$Planet1 = mysql_query($query_Planet1, $swb) or die(mysql_error());
$row_Planet1 = mysql_fetch_assoc($Planet1);
$totalRows_Planet1 = mysql_num_rows($Planet1);

 

Please help :|

Link to comment
Share on other sites

<?php
$tester = "1";
$colname_Planet1 = "-1";
if (isset($_SESSION['MM_Username'])) {
  $colname_Planet1 = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
}
mysql_select_db($database_swb, $swb);
$query_Planet1 = sprintf("SELECT * FROM planet WHERE ShipYard = %s AND PlayerName = %s", GetSQLValueString($tester, "int"), GetSQLValueString($colname_Planet1, "text"));
$Planet1 = mysql_query($query_Planet1, $swb) or die(mysql_error());
$row_Planet1 = mysql_fetch_assoc($Planet1);
$totalRows_Planet1 = mysql_num_rows($Planet1);
?>

 

EDIT: sorry, didnt realise it was sorted.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.