Jump to content

Probably a very simple mistake


Willo009

Recommended Posts

Hi Guys

          I hope its ok to post here with some problems im having. This is my 1st time with trying to use php, and my 1st time attempting to create a website. Im using some extensions from Webassist, and although they can cut down the time it takes to code php. There also not as stated on there website, and you need too pretty much understand Php too get them working. And i have been banging my head against walls for 6mth in there forum, which only ever seem too send you too w3schools website. In my mind thats not support more being Fobbed Off!

  I came across this forum and seen there are people out there too help, and everyone here seems to enjoy helping unlike webassist. I have a few problems, my 1st is on the index page. When i run it i get this error

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') WHERE id = -1 AND ((type = 'Dog')) AND ((country = 'England')) LIMIT 0, 10' at line 1

 

i will add the index page for anyone too look at, thanks in advance of any help with this.

 

[attachment deleted by admin]

Link to comment
Share on other sites

This is the info below, thanks for your help

 

<?php

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

  if (PHP_VERSION < 6) {

    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  }

 

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

 

  switch ($theType) {

    case "text":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;   

    case "long":

    case "int":

      $theValue = ($theValue != "") ? intval($theValue) : "NULL";

      break;

    case "double":

      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";

      break;

    case "date":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;

    case "defined":

      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

      break;

  }

  return $theValue;

}

}

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

  if (PHP_VERSION < 6) {

    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  }

 

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

 

  switch ($theType) {

    case "text":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;   

    case "long":

    case "int":

      $theValue = ($theValue != "") ? intval($theValue) : "NULL";

      break;

    case "double":

      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";

      break;

    case "date":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;

    case "defined":

      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

      break;

  }

  return $theValue;

}

}

 

mysql_select_db($database_petsCon, $petsCon);

$query_RSsearch = "SELECT * FROM petdata";

$RSsearch = mysql_query($query_RSsearch, $petsCon) or die(mysql_error());

$row_RSsearch = mysql_fetch_assoc($RSsearch);

$totalRows_RSsearch = mysql_num_rows($RSsearch);

$query_RSsearch = "SELECT * FROM petdata";

$RSsearch = mysql_query($query_RSsearch, $petsCon) or die(mysql_error());

$row_RSsearch = mysql_fetch_assoc($RSsearch);

$totalRows_RSsearch = mysql_num_rows($RSsearch);

 

?>

Link to comment
Share on other sites

Thanks Guys for offers off help, this is a great forum. I decided to re-do the pages that were causing me problems, it was a late night  :(  but there running just fine now. I have a question though, when passing values from my Results page to my Details page through a URL is the Querystring different because i have INNER JOINED 2 tables? This is my Querystring

 

<a href="DetailsPet.php?id=<?php echo $row_ResultsRS['id']; ?>">Details</a></td>

 

But its not passing on the values, and just shows the 1st results in database all the time. Im only just learning Php, but would i be right in thinking it to do with the 'id' as this is what joins the 2 tables. Do i have to state which 'id' to use? if so how do i do it?

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.