Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 151
0 Users 7 Guests Online
Forum Index » PHP + MySQL » Problem with MYSQL + PHP
Posted on Saturday 11th August 2007 at 04:00 PM
Diablosblizz
templates/default/images/noavatar.png's Avatar
Senior Member
Hey, I am trying to make my own news system for my site. So far, I LOVE IT! But... problems lie ahead.

I have everything working, it display's the subject and message. If there is something in the $message variable it will display read more.

My problem is with the read more... Here is the code:

PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
case 'readmore':
$id = $_GET[id];
$newsie = mysql_query("SELECT * FROM `news` WHERE `id` = '$_GET[id]'");
echo '<div align="center"><table width="90%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td><table width="100%" border="0" cellspacing="0" cellpadding="0">

        <tr>
          <td width="1%" align="left" valign="top"><img src="images/blue_top_left.gif" width="7" height="7" /></td>
          <td width="98%" background="images/blue_top.gif"></td>
          <td width="1%" align="right" valign="top"><img src="images/blue_top_right.gif" width="7" height="7" /></td>
        </tr>
        <tr>
          <td background="images/test.png" style="background-repeat: repeat-y; background-color: #305F7F"></td>
          <td bgcolor="#305F7F" style="padding-bottom: 3px;"><div align="center"><span class="title">'; 
          echo $newsie[subject]; echo '</span></div></td>

          <td background="images/blue_right_side.gif" bgcolor="#305F7F" style="background-position: right; background-repeat: repeat-y"></td>
        </tr>
        
      </table></td>
    </tr>
    <tr>
      <td><table width="100%" border="0" cellpadding="1" cellspacing="0" bgcolor="#000000">
        <tr>
          <td><table width="100%" border="0" cellpadding="1" cellspacing="0" bgcolor="#FFFFFF" style="padding: 5px;">
            <tr>

              <td><font size="1"><center>';
break;


That's just the "readmore" case. You see where it says $newsie[subject]? Well where that variable is defined is where the subject SHOULD show up, but it doesn't.

Does anybody have any ideas.
Posted on Saturday 11th August 2007 at 04:20 PM
DanielXP
avatars/1.png's Avatar
Senior Member
You have not fetched it.

PHP Code
1
2
$newsie = mysql_query("SELECT * FROM `news` WHERE `id` = '$_GET[id]'"); 
$newsie = mysql_fetch_array($newsie);
Posted on Saturday 11th August 2007 at 05:13 PM
Diablosblizz
templates/default/images/noavatar.png's Avatar
Senior Member
Wow, I am stupid. Thanks Dan.
Posted on Saturday 11th August 2007 at 06:22 PM
DanielXP
avatars/1.png's Avatar
Senior Member
Locked :)