Jump to content

IPB 'Syndicate'


Revan

Recommended Posts

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:[code]<?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);

?>[/code]

Any help would be appreciated  ;)
Link to comment
Share on other sites

$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.
Link to comment
Share on other sites

[quote author=ChaosXero link=topic=100874.msg398582#msg398582 date=1153142842]
$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.

[/quote]

Thanks. I'll try that as soon as the webmaster gets online.
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.