GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 30-Jun-2003, 01:23
norok norok is offline
New Member
 
Join Date: Jun 2003
Posts: 23
norok is an unknown quantity at this point

Thanx for the sql query, but there must be a little mistake


Hallo, first of all thanx for your efforts for th sql command:
PHP Code:

try this:



PHP:--------------------------------------------------------------------------------

<?php
$title_id = intval( $_GET['id'] ); /*  Forgot to mention this before...
                                       make sure type is (int); IMPORTANT!  */
$sql = 'SELECT SO.vorname, SO.name, SO.userid
       FROM rel_titel_user AS RTU, Standort AS SO
       WHERE RTU.titelid = '.$title_id.'
       AND S.userid = RTU.userid';
$result3 = mysql_query( $sql );
// I suppose this could return more than one row, huh?
echo "<ol>\n";
// to extend: use mysql_num_rows() to check if empty or n/a...
line 313: while( $row = mysql_fetch_assoc($result3) )
{
  echo     '  <li>Location: '.$row['vorname'].', '.$row['name']."</li>\n";
}
echo "</ol>\n";
?> 

But I get this message:Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in d:\programme\apache group\apache\htdocs\bibli\find.php on line 313

Would be greate you could explain that to me.

Matthias
  #2  
Old 30-Jun-2003, 01:32
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Oops! I included a typo, it should be :

PHP Code:

<?php
$title_id = intval( $_GET['id'] ); /*  Forgot to mention this before...
                                       make sure type is (int); IMPORTANT!  */
$sql = 'SELECT SO.vorname, SO.name, SO.userid
       FROM rel_titel_user AS RTU, Standort AS SO
       WHERE RTU.titelid = '.$title_id.'
       AND SO.userid = RTU.userid';  // I missed out the O in SO here
$result3 = mysql_query( $sql );
// I suppose this could return more than one row, huh?
echo "<ol>\n";
// to extend: use mysql_num_rows() to check if empty or n/a...
line 313: while( $row = mysql_fetch_assoc($result3) )
{
  echo     '  <li>Location: '.$row['vorname'].', '.$row['name']."</li>\n";
}
echo "</ol>\n";
?>

  #3  
Old 30-Jun-2003, 01:52
norok norok is offline
New Member
 
Join Date: Jun 2003
Posts: 23
norok is an unknown quantity at this point

Sorry but I get the same error:


Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in d:\programme\apache group\apache\htdocs\bibli\find.php on line 314

Matthias
  #4  
Old 30-Jun-2003, 01:56
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
How is the url to get to this page?

e.g.

http://www.example.com/find.php?id=23

Do you append the id query string (?id=23) to the URL?
  #5  
Old 30-Jun-2003, 02:06
norok norok is offline
New Member
 
Join Date: Jun 2003
Posts: 23
norok is an unknown quantity at this point
E.G:...bibli/find.php?sqlType=title&authID=47
is an url appended command to show all titles from on author.

Matthias

PS:You meant this?
  #6  
Old 30-Jun-2003, 02:15
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
This;

sqlType=title

it's actually sqlType=1 ?

If yes, change the code to:

PHP Code:

<?php
$title_id = intval( $_GET['sqlType'] ); //  Forgot to mention this 
// all the other codes as before
?>

  #7  
Old 30-Jun-2003, 02:33
norok norok is offline
New Member
 
Join Date: Jun 2003
Posts: 23
norok is an unknown quantity at this point
hI , its actually without sql,only id:
PHP Code:

$title_id = intval( $_GET['id'] ); 



Matthias
  #8  
Old 30-Jun-2003, 03:12
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Hang on Matthias...

We are going around in circles; you have to tell me what the regular link is going to look like.

e.g. if your link is going to be .../find.php?thetitelid=234, then this line in the code should be:
PHP Code:

<?php
$title_id = intval( $_GET['thetitelid'] );
?>

  #9  
Old 30-Jun-2003, 03:29
norok norok is offline
New Member
 
Join Date: Jun 2003
Posts: 23
norok is an unknown quantity at this point

difficult:


There is actually no special link to get the location(standort)
information.
There is a while construct which loops through the database and
shows me then all the results(books) it can find. Undersome book
specifics like edition,author and so on I wanted to include
a function to show me the Standort too, so I inserted
two new tables, the rel-title-user and standort.
And I just wantetd to put the function just before the end of the while bracket so after every result the location is put out.
Thats it-so no link.

Matthias
  #10  
Old 30-Jun-2003, 03:40
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
See, if you had explained that earlier, we would be discussing some whole new theory by now

Anyway, the trick now is to find the variable that holds the titelid in the existing script and replace that variable into our code earlier:

PHP Code:

<?php
$title_id = intval( $the_titelid_variable );
// the rest of the code...
?>

 
 

Recent GIDBlogLast Week of IA Training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL multiple languages query samtediou MySQL / PHP Forum 6 23-Jul-2003 13:09
mysql vs sql - what is the difference zabell MySQL / PHP Forum 2 14-Jun-2003 16:32
Search Engine Positioning 101 and 201 "How To" Tips... 000 Search Engine Optimization Forum 0 29-May-2003 10:34

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 16:57.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.