Jump to content


Photo

IPB 'Syndicate'


  • Please log in to reply
6 replies to this topic

#1 Revan

Revan
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 17 July 2006 - 01:20 PM

Hello, my name is Revan and I am very new to PHP. My question is directed towards anyone who is familiar with the MySQL database setup of Invision Power Boards. What I want to do is connect to the MySQL database, get the topic title if it has a certain description, the url, and save it to be displayed in a sidebar for a webpage. As of the moment, I cannot say the address of the page... Here is the code so far:
<?php
require('config.php');

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die                      ('Error connecting to mysql');

$sql = 'SELECT `title` FROM `ibf_topics` WHERE `description`=\'=SCDTI=\'';

mysql_close($conn);

?>

Any help would be appreciated  ;)

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 17 July 2006 - 01:25 PM

Welcome to the board. We have a specific forum for help with third party scripts, this really should be posted in there.

#3 Revan

Revan
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 17 July 2006 - 01:26 PM

This is a script I wrote myself.

#4 ChaosXero

ChaosXero
  • Members
  • PipPipPip
  • Advanced Member
  • 80 posts

Posted 17 July 2006 - 01:27 PM

$sql = 'SELECT `title` FROM `ibf_topics` WHERE `description`=\'=SCDTI=\'';
change to $sql = "SELECT `title` FROM `ibf_topics` WHERE `description`= '=SCDTI=' "; and try again.  also, you need a query statement in there.
Like:
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
echo $row['id'] // assuming your database has an 'id' field. Replace ID with feild name.  You could also use a loop here.\

Hope this helps.  I was recently stuggling with this too.


#5 Prismatic

Prismatic
  • Members
  • PipPipPip
  • Advanced Member
  • 503 posts
  • LocationSan Diego

Posted 17 July 2006 - 01:27 PM

Why was this moved? It's not a third party script.

#6 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 17 July 2006 - 01:28 PM

Yeah I see now. Anyway.. sorry, im not familiar with IPB... you might be lucky though.

#7 Revan

Revan
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 17 July 2006 - 01:29 PM

$sql = 'SELECT `title` FROM `ibf_topics` WHERE `description`=\'=SCDTI=\'';
change to $sql = "SELECT `title` FROM `ibf_topics` WHERE `description`= '=SCDTI=' "; and try again.  also, you need a query statement in there.
Like:
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
echo $row['id'] // assuming your database has an 'id' field. Replace ID with feild name.  You could also use a loop here.\

Hope this helps.  I was recently stuggling with this too.


Thanks. I'll try that as soon as the webmaster gets online.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users