perezf Posted June 3, 2006 Share Posted June 3, 2006 Hey everyone i just need help loading specific items from a database into certain sections of my tablethe item-titleimgand the descriptionI need to transfer it from this code into[code]print "<div class=\"item\">\n". "\t<div class=\"boxcontent\">\n". "\t\t<p>\n". "\t\t<span class=\"item-title\"><a href=\"".$link_href."\">".htmlspecialchars(stripslashes($table_data['title']))."</a></span>\n". "\t\t<a href=\"".$link_href."\"><img src=\"".$img_src."\" class=\"item-thumb\" /></a>\n". "\t\t<span class=\"item-info\">".stripslashes($table_data['description'])."</span>\n". "\t\t<p class=\"item-clear\"></p>\n". "\t\t</p>\n". "\t</div>\n". "</div>\n";[/code]This table[code]<table width="95%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="2"><img src="images/bar_l.jpg" width="2" height="24" alt=""></td> <td background="images/bar_bg.jpg"><span class="style2>Item title goes here</span></td> <td width="2"><img src="images/bar_r.jpg" width="2" height="24" alt=""></td> </tr> </table></td> </tr> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="1" bgcolor="#1B6A00"></td> <td align="center" bgcolor="#FFFFFF> Image and description go here</td> <td width="1" bgcolor="#1B6A00"></td> </tr> </table></td> </tr> <tr> <td height="1" bgcolor="#1B6A00"></td> </tr> </table>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/11067-loading-items-from-database-into-specific-spots/ Share on other sites More sharing options...
jeremywesselman Posted June 3, 2006 Share Posted June 3, 2006 [code]<table width="95%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="2"><img src="images/bar_l.jpg" width="2" height="24" alt=""></td> <td background="images/bar_bg.jpg"><span class="style2><a href="<?php echo $link_href; ?>"><?php echo htmlspecialchars(stripslashes($table_data['title'])); ?></a></td> <td width="2"><img src="images/bar_r.jpg" width="2" height="24" alt=""></td> </tr> </table> </td> </tr> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="1" bgcolor="#1B6A00"></td> <td align="center" bgcolor="#FFFFFF><a href="<?php echo $link_href; ?>"><img src="<?php echo $img_src; ?>" class="item-thumb" /></a> <?php echo stripslashes($table_data['description']); ?></td> <td width="1" bgcolor="#1B6A00"></td> </tr> </table> </td> </tr> <tr> <td height="1" bgcolor="#1B6A00"></td> </tr> </table> </td> </tr></table>[/code]All you have to do is copy the variables into the new layout.[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Jeremy[!--colorc--][/span][!--/colorc--] Quote Link to comment https://forums.phpfreaks.com/topic/11067-loading-items-from-database-into-specific-spots/#findComment-41365 Share on other sites More sharing options...
perezf Posted June 3, 2006 Author Share Posted June 3, 2006 Its not workingHeres the code i am using[code]print '<table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td width=\"2\"><img src=\"images/bar_l.jpg\" width=\"2\" height=\"24\" alt=\"\"></td> <td background=\"images/bar_bg.jpg\"><span class=\"style2><a href=\"<?php echo $link_href; ?>\"><?php echo htmlspecialchars(stripslashes($table_data['title'])); ?></a></td> <td width=\"2\"><img src=\"images/bar_r.jpg\" width=\"2\" height=\"24\" alt=\"\"></td> </tr> </table> </td> </tr> <tr> <td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td width=\"1\" bgcolor=\"#1B6A00\"></td> <td align=\"center\" bgcolor=\"#FFFFFF><a href=\"<?php echo $link_href; ?>\"><img src=\"<?php echo $img_src; ?>\" class=\"item-thumb\" /></a> <?php echo stripslashes($table_data['description']); ?></td> <td width=\"1\" bgcolor=\"#1B6A00\"></td> </tr> </table> </td> </tr> <tr> <td height=\"1\" bgcolor=\"#1B6A00\"></td> </tr> </table> </td> </tr></table>';[/code] Quote Link to comment https://forums.phpfreaks.com/topic/11067-loading-items-from-database-into-specific-spots/#findComment-41366 Share on other sites More sharing options...
jeremywesselman Posted June 3, 2006 Share Posted June 3, 2006 You don't need to print everything out. I wrote it to where it would echo the variables in the correct spots.You should be able to use it they EXACT way I wrote it, unless the variables are not the same.[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Jeremy[!--colorc--][/span][!--/colorc--] Quote Link to comment https://forums.phpfreaks.com/topic/11067-loading-items-from-database-into-specific-spots/#findComment-41375 Share on other sites More sharing options...
perezf Posted June 3, 2006 Author Share Posted June 3, 2006 i still get an errorWarning: Unexpected character in input: '\' (ASCII=92) state=1 in /hsphere/local/home/way2fr3s/2fr3sh.com/new project/videos.php on line 12Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /hsphere/local/home/way2fr3s/2fr3sh.com/new project/videos.php on line 18heres the whole code[code]<?php$mysql_host = '********';$mysql_user = '********';$mysql_pass = '********';$mysql_db = '********';$dbTable = 'videos';$records_per_page = 7;mysql_connect ($mysql_host, $mysql_user, $mysql_pass);mysql_select_db ($mysql_db);$count_query = \"SELECT count(*) from \".$dbTable;$rh = mysql_query($count_query);list ($record_count) = mysql_fetch_array($rh);$max_pages = (floor($record_count / $records_per_page) + 1);if (isset($_GET['pg'])) { if ($_GET['pg'] > 1) { if ($_GET['pg'] > $max_pages) { $current_page = $max_pages; } else { $current_page = $_GET['pg']; } } else { $current_page = 1; }} else { $current_page = 1;}$limit_start = ($current_page - 1) * $records_per_page;$data_query = \"SELECT * FROM \".$dbTable.\" ORDER BY `id` DESC LIMIT \" . $limit_start . \", \" . $records_per_page;$rh = mysql_query ($data_query);while ($table_data = mysql_fetch_array($rh)){ $server = 'http://fishbash.com/'; $link_href = 'http://www.2fr3sh.com/index.php?page=PlayVideos&id='.stripslashes($table_data['id']); $img_src = $server.$dbTable.'/thumbs/'.stripslashes($table_data['id']).'.gif';?><table width="95%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="2"><img src="images/bar_l.jpg" width="2" height="24" alt=""></td> <td background="images/bar_bg.jpg"><span class="style2><a href="<?php echo $link_href; ?>"><?php echo htmlspecialchars(stripslashes($table_data['title'])); ?></a></td> <td width="2"><img src="images/bar_r.jpg" width="2" height="24" alt=""></td> </tr> </table> </td> </tr> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="1" bgcolor="#1B6A00"></td> <td align="center" bgcolor="#FFFFFF><a href="<?php echo $link_href; ?>"><img src="<?php echo $img_src; ?>" class="item-thumb" /></a> <?php echo stripslashes($table_data['description']); ?></td> <td width="1" bgcolor="#1B6A00"></td> </tr> </table> </td> </tr> <tr> <td height="1" bgcolor="#1B6A00"></td> </tr> </table> </td> </tr></table>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/11067-loading-items-from-database-into-specific-spots/#findComment-41379 Share on other sites More sharing options...
jeremywesselman Posted June 3, 2006 Share Posted June 3, 2006 It is because you are escaping all of quotation marks. Unless it is inside a string that is being printed, they do not need to be escaped.[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Jeremy[!--colorc--][/span][!--/colorc--] Quote Link to comment https://forums.phpfreaks.com/topic/11067-loading-items-from-database-into-specific-spots/#findComment-41383 Share on other sites More sharing options...
perezf Posted June 3, 2006 Author Share Posted June 3, 2006 [!--quoteo(post=379552:date=Jun 3 2006, 01:15 AM:name=jeremywesselman)--][div class=\'quotetop\']QUOTE(jeremywesselman @ Jun 3 2006, 01:15 AM) [snapback]379552[/snapback][/div][div class=\'quotemain\'][!--quotec--]It is because you are escaping all of quotation marks. Unless it is inside a string that is being printed, they do not need to be escaped.[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Jeremy[!--colorc--][/span][!--/colorc--][/quote]Yes that same code is being printed over and over for each separate videothats what i was trying to figure outthe code works but when i try to change to layout it doesn i always get error andi was wondering if anyone could help me do this? Quote Link to comment https://forums.phpfreaks.com/topic/11067-loading-items-from-database-into-specific-spots/#findComment-41384 Share on other sites More sharing options...
jeremywesselman Posted June 3, 2006 Share Posted June 3, 2006 You need to go through your code and delete all the \ before the ". That is why it is not working correctly. Unless the " is inside a set of "", you need to remove the \.[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Jeremy[!--colorc--][/span][!--/colorc--] Quote Link to comment https://forums.phpfreaks.com/topic/11067-loading-items-from-database-into-specific-spots/#findComment-41387 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.