#1 (permalink)  
Old 06-24-09, 03:03 AM
SniperTowers SniperTowers is offline
Wannabe Coder
 
Join Date: Dec 2008
Posts: 143
Thanks: 5
Thanked 0 Times in 0 Posts
Error

Here's my code:
PHP Code:

echo "<img align=\"left\" src=\"images/";

        echo 
$row['image'];
        echo 
"\" width=\"120px\" height=\"60px\" border=\"1px\">"
I get this error:
Parse error: syntax error, unexpected T_STRING in /home/shuffled/public_html/mel/offers.php on line 47

Line 47 is the top line. What is wrong? Because to me the code looks fine.
Reply With Quote
  #2 (permalink)  
Old 06-24-09, 03:07 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Can you post a few lines above that? There's no error as far as I can see.
Reply With Quote
  #3 (permalink)  
Old 06-24-09, 03:12 AM
SniperTowers SniperTowers is offline
Wannabe Coder
 
Join Date: Dec 2008
Posts: 143
Thanks: 5
Thanked 0 Times in 0 Posts
Here's the full code:

PHP Code:

$no_results TRUE;   // No results found yet

$howmany    6;     // Return 10 results per query
 
// Set default starting point of query to 0, or, if set, to $_GET['rs']
$row_start  = (isset($_GET['rs'])) ? $_GET['rs'] : 0;
 
 
// Do our SQL query, with something like LIMIT 0, 10
$sql    "SELECT SQL_CALC_FOUND_ROWS id, title, link, image, value, value2, description  FROM offers WHERE categoryID='$cat' ORDER BY `id` DESC LIMIT "$row_start .", "$howmany ."";
$result mysql_query($sql);  
 
 
// Get the number of rows that would have been returned WITHOUT a limit clause, to be used later for paging.
$count_sql        "SELECT FOUND_ROWS() AS total";
$count_sql_result mysql_query($count_sql);
$count_row       mysql_fetch_array($count_sql_result);
$count_result       $count_row['total'];
 
// Start looping through our result set
while($row mysql_fetch_array($result)) {
    
$no_results FALSE;
 
    
// Save results of query to $line_output
    
$line_output .= "


    echo "
<img align=\"left\" src=\"images/";
        echo 
$row['image'];
        echo 
"\" width=\"120px\" height=\"60px\" border=\"1px\">";
        echo 
"<b><a href=\"";
        echo 
$row['link'];
        echo 
"\">";
    echo 
$row['title'];
        echo 
"</a> | ";
        if (
$row['value'] !=0)
        echo 
"£".$row['value'];
        if (
$row['value'] !=&& $row['value2'] !=0)
             echo 
" | ";
        if (
$row['value2'] !=0)
             echo 
$row['value2']."%";
        echo 
"</b><br/>";
        echo 
stripslashes($row['description']);
     echo 
" <br/><b><a style=\"float: right\" href=\"completed.php?offer=";
        echo 
$row['id'];
        echo 
"&user=";
        echo 
$uid;
        echo 
"\"><img border=\"0px\" src=\"images/completed.png\"/></a></b><br/><br/>";
        echo 
"<img border=\"0px\" src=\"images/lines5.png\"/><br/><br/>";

}

// Don't bother building paging if we don't have records
if ($no_results) {
    
$line_output "No records found...";
    
$page_output "";
}
else {
    
// Build <prev> and <next> links and save to $page_output
    
$rs_prev $row_start $howmany// where would prev page start, given current start less no. of records
    
$rs_next $row_start $howmany// where would next page start, given current start plus no. of records
 
    // If for some reason the next <prev> starting point is negative, do not display <prev>
    // This happens when our current starting point is already 0
    // This may happen if some smartass manually changes the rs= bit in the url
    
$page_output_prev     = ($rs_prev 0) ? "" "<div id=\"next\"><a href='?layouts=".$cat."&rs=".$rs_prev."'>Previous</a></div>";
 
    
// Will the next page jump start point exceed the number of records returned?
    // If so, don't display <next>'
    
$page_output_next     = ($rs_next >= $count_result) ? "" "<div id=\"next\"><a href='?layouts=".$cat."&rs=".$rs_next."'>Next</a></div>";  
 
    
// Just something to put between <prev> & <next>, IF they are both active
    
if (($page_output_prev == "") || ($page_output_next == "")) {$page_output_breaker "";}
    else { 
$page_output_breaker " || ";}
 
    
// Build final paging output
    
$page_output $page_output_prev $page_output_breaker $page_output_next;

Reply With Quote
  #4 (permalink)  
Old 06-24-09, 03:13 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
This is an easy one.

Take a closer look at the color highligted code. The error is close to the lines you posted above.
Reply With Quote
  #5 (permalink)  
Old 06-24-09, 05:45 AM
SniperTowers SniperTowers is offline
Wannabe Coder
 
Join Date: Dec 2008
Posts: 143
Thanks: 5
Thanked 0 Times in 0 Posts
Ahhh, Thanks I missed that. For some reason I can't get the prev/next links to show however if you go to /offers.php?offers=11&rs=2 the pagination works fine. :S
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ and MSSQL tutorials? scott2500uk C/C++ 8 05-11-09 02:33 AM
[SOLVED] 500 Internal Server Error - Please help Dawn Perl 15 07-08-08 11:08 AM
Syntax Error Nikas Database 4 05-15-08 10:48 AM
server error in ' / ' application vikkygupta2005 ASP.NET 1 11-10-06 06:07 AM
ASP upload prob minority ASP 1 06-27-05 08:35 AM


All times are GMT -5. The time now is 08:38 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.