Re: [PHP-DB] SELECT LIKE with % and without %

2009-05-04 Thread Eleonora De Marinis

$sql = SELECT * FROM table WHERE ID ='$_GET[id]' AND title LIKE
'%$_GET[word]%';



 Original Message  
Subject: [PHP-DB] SELECT LIKE with %' and without %'
From: Emiliano Boragina emiliano.borag...@gmail.com
To: php-db@lists.php.net
Date: 05/03/2009 01:43 AM

Hello.

I am using this:
$sql = SELECT * FROM table WHERE ID LIKE '%$_GET[id]%' AND title LIKE
'%$_GET[word]%';

But I want exactlu ID, not one part of many possibles Ids in the DB.
How can I do that?

Thanks

+  _
   // Emiliano Boragina _
   // DiseƱo  ComunicaciĆ³n //
+  _
   // emiliano.borag...@gmail.com  /
   // 15 40 58 60 02 ///
+  _
  





Re: [PHP-DB] Problems with INNER JOIN

2009-01-29 Thread Eleonora De Marinis

Try this:

$sql =
SELECT admin.AdminID AS adminID, workorders.AdminID AS workadmin
FROM admin
INNER JOIN
workorders ON
 (admin.AdminID=workorders.AdminID)
WHERE admin.UserName =   '.$_SESSION['user'].' ;


maybe you have to call with different name the table fields

Terion Miller ha scritto:

Hi Everyone! I am having problems getting an INNER JOIN to work and need
some tips trouble shooting where the problem may be.

What I'm trying to do is match up AdminID's from two tables and display only
that users orders, sounds simple enough right...but I can't get it to return
the AdminID...

My Query:

   $sql =
 SELECT admin.AdminID , workorders.AdminID
 FROM admin
 INNER JOIN
 workorders ON
  (admin.AdminID=workorders.AdminID)
 WHERE admin.UserName =   '.$_SESSION['user'].' ;


  $result = mysql_query ($sql);
  $row = mysql_fetch_assoc ($result);
  $Total = ceil(mysql_num_rows($result)/$PerPage);

Thanks for any tips on how else I can accomplish this...
Terion