Jump to content

WHERE this is this and this is this???


Nothadoth

Recommended Posts

well I am using this and it says that it isn't working.

[code]  $queryphones = mysql_query("SELECT * FROM phones WHERE manufacturer='$catmode' AND special='$type' ORDER by model ASC");
while($phones = mysql_fetch_array($queryphones)) {

}[/code]

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/noth/public_html/igbltd/browse.php on line 313

http://www.finalfantasyfan.net/igbltd/browse.php?catmode=Sony%20Ericsson&parentmode=Phones&type=Walkmans

Please help
Link to comment
Share on other sites

Try adding an or die statement. Also, separating the query out will help so you can echo the query string:
  $sql = "SELECT * FROM phones WHERE manufacturer='$catmode' AND special='$type' ORDER by model ASC";
  $queryphones = mysql_query($sql) or die("mysql_error()<br />Sql:$sql");
while($phones = mysql_fetch_array($queryphones)) {

}
Link to comment
Share on other sites

<?php

session_start();

$database_host = "localhost";
$database_username = "";
$database_password = "";
$database_name = "";

$connection = mysql_connect($database_host, $database_username, $database_password) or die(mysql_error());
$db = mysql_select_db($database_name, $connection);

$catmode = "a";
$type = "a";

$queryphones = mysql_query("SELECT * FROM phones WHERE manufacturer='$catmode' AND special='$type' ORDER by model ASC");

while($phones = mysql_fetch_array($queryphones))
{
echo"$phones[manufacturer]";
}

?>

that works and echos out results...
Link to comment
Share on other sites

still not working.

Error:
[code]Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/noth/public_html/igbltd/browse.php on line 319
[/code]

Ill give you the whole snippet from that area. It starts at line 286 and ends at line 300
[code]if ($type == "All") {
 
  $queryphones = mysql_query("SELECT * FROM phones WHERE manufacturer='$catmode' ORDER by model ASC");
 
  $temp1 == "";
 
} elseif (!$type == "All") {
 
  $temp1 == $type;
 
  $sql = "SELECT * FROM phones WHERE manufacturer='$catmode' AND special='$type' ORDER by model ASC";
  $queryphones = mysql_query($sql) or die("mysql_error()
Sql:$sql");
 
}[/code]
Link to comment
Share on other sites

Well i would guess the error is on the other query then
[code]
<?php
if ($type == "All") {
 
  $sql= "SELECT * FROM phones WHERE manufacturer='$catmode' ORDER by model ASC";
  $queryphones = mysql_query($sql) or die("mysql_error() Sql:$sql");
 
  $temp1 == "";
 
} elseif (!$type == "All") {
 
  $temp1 == $type;
 
  $sql = "SELECT * FROM phones WHERE manufacturer='$catmode' AND special='$type' ORDER by model ASC";
  $queryphones = mysql_query($sql) or die("mysql_error() Sql:$sql");
 
}
?>
[/code]
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.