Jump to content

Padgoi

Members
  • Posts

    174
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Padgoi's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. I have this script that pulls post data from a database and displays it on my site. I need this to update in real time with Ajax whenever the topics table updates. I know literally nothing about Ajax. Can someone assist with this please? <?php //connect to the server $connect = mysql_connect("localhost","",""); //connect to the database mysql_select_db(""); //query the database $query = mysql_query("SELECT * FROM topics ORDER BY last_post"); //fetch the results / convert results into an array WHILE($rows = mysql_fetch_array($query)): $topic_id = $rows['last_post']; $topic_title = $rows['title']; $reply_author = $rows['last_poster_name']; $reply_time = date('h:i A', $rows['last_post']); $reply_date = date('l, F d, Y', $rows['last_post']); endwhile; echo "The last post was made in <font color='blue'>$topic_title</font> by <font color='red'>$reply_author</font> at <font color='green'>$reply_time</font> on <font color='brown'>$reply_date</font>."; ?>
  2. It's a timestamp. I just don't know how to incorporate it into my current code.
  3. Can you please help a bit more? My PHP knowledge is very limited.
  4. Hey all, So I have this very small script that is simply pulling information from a dbase and displaying it. The problem is the date in the dbase is stored in a string (it looks like 1424375795 or something). I need to convert that number to the date and time. Here's the code: <?php //query the database $query = mysql_query("SELECT * FROM topics ORDER BY last_post"); //fetch the results / convert results into an array WHILE($rows = mysql_fetch_array($query)): $topic_id = $rows['last_post']; $topic_title = $rows['title']; $reply_author = $rows['last_poster_name']; $reply_time = $rows['last_post']; endwhile; echo "The last post was made in <font color='blue'>$topic_title</font> by <font color='red'>$reply_author</font> at <font color='green'>$reply_time</font>."; ?>
  5. Ok, so I did that and got this error: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' at line 1
  6. Yeah, it's actually 2 tables, groupcomic and yrat. I ran the query directly in MYSQL and got this error: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '$q = 'SELECT y.*, (SUM(`rating`)/COUNT(`rating`)) AS `avg`, COUNT(`rating`) AS `' at line 1 I assume it has something to do with the num_rat field but I honestly have no idea. I had that field set up as INT (11).
  7. $q = 'SELECT y.*, (SUM(`rating`)/COUNT(`rating`)) AS `avg`, COUNT(`rating`) AS `num_rat` FROM `groupcomic` `y` LEFT JOIN `yrat` ON `sid` = `skey` where panels>=3 GROUP BY `sid` ORDER BY `avg` DESC LIMIT 0,5'; This line seems to be causing problems in one of my scripts in that it keeps referring me to this line and saying there is an invalid MYSQL result resource. I'm fairly certain my table structure is off. Can someone please tell me, based on this line, what fields I should have in my table and and what type they should be? I know the table name is groupcomic.
  8. Yes, it's working, I just need the table structure to save the entries. My SQL skills are not up to snuff with you guys, that's why I was asking for help. I don't know how to run this show create table query you speak of.
  9. Anyone? I just need the table structure for this. Any help would really be appreciated. Thanks!
  10. <?php if(isset($id)){?> <html> <HEAD> <STYLE type="text/css"> <!-- td { vertical-align: top; } #corner { display: block; position: absolute; left: 0; top: 0px; overflow: visible; width: 100px; height: 100px; margin: 0 0 0 0; padding: 0; z-index: 9999; border: none; float: none; } #infobar { display: none; z-index: 1; height: 100px; width:100%; top: 0; left: 0; position: absolute; margin: 0px 0px 0px 0px; background-color: #FFFFFF; overflow: hidden; border-bottom: dotted 1px #000; } #keywords { border: 1px solid black; padding: 5px 5px 5px 5px; width: 500px; text-align: left;} .keyword { background-color: #CCCCFF; color:0000FF; text-decoration:underline; font-weight:bold; } #loader { position: relative; top: 200px; border: 0px; display: block; } --> </STYLE> <script type="text/javascript"> var is_vis = false; function showvote() { if (is_vis == false) { document.getElementById('infobar').style.display = 'block'; if (document.getElementById('corner') != false) { document.getElementById('corner').style.display = 'none'; } if (document.getElementById('restroom') != false) { document.getElementById('restroom').style.display = 'none'; } is_vis = true; } else { document.getElementById('infobar').style.display = 'none'; if (document.getElementById('corner') != false) { document.getElementById('corner').style.display = 'block'; } if (document.getElementById('restroom') != false) { document.getElementById('restroom').style.display = 'block'; } is_vis = false; } return false; } </script> </HEAD> <body> <?php $part1=' <div id="corner"> <img src="CE2.gif" border="0" usemap="#rc" style="filter:alpha(opacity=60);opacity: 0.60;-moz-opacity:0.60;"> <map name="rc"> <area shape="poly" coords="0,0,100,0,0,100" href="#" onclick="javascript:showvote(); return false;" title="" /></map></div><div id="restroom"></div> <div id="infobar"> <table align="left"><tr><td style="text-align: center;"> <a onclick="javascript:showvote(); return false;"><img src="CE2.gif" border="0"></a> <br></td><td> '; $part2=' </td> </tr> </table> </div>'; } function stars($rating){ if($rating!=0){ $disp="<br />"; for($i=1;$i<=$rating;$i++) $disp.="<img src=\"star.png\">"; $disp.=""; } else { $disp="<br/><img src=blank.gif width=12 height=12>";} return $disp; } function show_site2($skey, $title, $rating, $user, $image) { $disp= stars($rating); //$br=""; //if($rating=0) //$br="<br />"; return sprintf("<center><a href=\"?id=%s\">%s</a> %s<br /><a href=\"?id=%s\"><img height=75 width=75 src=\"%s\"></a><br />By <a href=\"?u=%s\">%s</a></center><br />\n", $skey, $title, $disp,$skey, $image,$user,$user); } function show_site($skey, $title, $rating, $user, $image) {//<a href=\"wlist.php?u=%s\"> //$br=""; $disp= stars($rating); //if($rating=0) //$br="<br />"; return sprintf("<td width=150><center><a href=\"?id=%s\">%s </a>%s<br /><a href=\"?id=%s\"><img height=75 width=75 src=\"%s\"><br /></a>By <a href=\"?u=%s\">%s</a></center><br /><br /></td>\n", $skey, $title, $disp,$skey,$image,$user,$user); } include("wootcfg.php"); if(isset($_GET[$uname])) { if($_GET[$uname] == $pword) { setcookie('lol', md5($pword), time() + 3600); header('location: ?'); die('Logged in'); } } if(isset($latest)){ title('Top 5 Strips', 'Top 5 Strips','',true); echo 'Menu:<br /><a href="?new&complete">Create New Complete Strip</a><br /><a href="?new">Create New Single Panel Strip</a><br/> <a href="?list=1">View Available 1-Panel Strips</a><br/> <a href="?list=2">View Available 2-Panel Strips</a><br/><a href="?list=3">View Completed Strips</a><br/><a href="?latest">Top 5 Strips</a><br />'; $q = 'SELECT y.*, (SUM(`rating`)/COUNT(`rating`)) AS `avg`, COUNT(`rating`) AS `num_rat` FROM `groupcomic` `y` LEFT JOIN `yrat` ON `sid` = `skey` where panels>=3 GROUP BY `sid` ORDER BY `avg` DESC LIMIT 0,5'; echo "<table><tr><td width=300 valign='top'>"; echo '<h2><center>Top Rated</center></h2><br />'; for($r = mysql_query(sprintf($q, 'avg')); $row = mysql_fetch_assoc($r) { echo show_site2($row['sid'], $row['title'], round($row['avg'], 2),$row['creator'],$row['file']); } echo '</td><td width =300 valign="top"><h2><center>Latest</center></h2><br />'; $q = 'SELECT y.*, (SUM(`rating`)/COUNT(`rating`)) AS `avg`, COUNT(`rating`) AS `num_rat` FROM `groupcomic` `y` LEFT JOIN `yrat` ON `sid` = `skey` GROUP BY `sid` ORDER BY `id` DESC LIMIT 0,5'; for($r = mysql_query(sprintf($q, 'id')); $row = mysql_fetch_assoc($r) { $prnt=$row['parent']; if($row['sid']==$row['parent']){ echo show_site2($row['sid'], $row['title'], round($row['avg'], 2),$row['creator'],$row['file']);} else { $sql="select * from groupcomic where sid='$prnt'"; $res=mysql_query($sql); $prnet=mysql_fetch_assoc($res); $title=$prnet['title']; echo show_site2($row['sid'], $title, round($row['avg'], 2),$row['creator'],$row['file']); } } echo "</td></tr></table>"; } if(!isset($list) && !isset($new) && !isset($id) && !isset($latest) && !isset($woot) && !isset($u)){ title('WootStrips', 'WootStrips','',true); ?>Welcome to the new and improved WootStrips, a unique idea that allows users to create their own funny images or comic strips. Using the Paint program on your computer, users can easily create their own humorous pictures, images, or strips by drawing a simple image or skit and saving it as a <b>.jpg, .gif, .jpeg, .bmp, or .png</b> file. Users can then take those image files and insert them into the Creation Form. However, now, users can also create single-panel strips and have OTHER USERS continue the strips by adding their own panels. It really can be a blast! Not only that, but any really funny strips will be put on the homepage for other users to enjoy. So give it a try. <br><br> A brief description of the Menu Options below:<br> <b>Create New Complete Strip</b> - create your own full and completed Strip, just like before. This will now net you 50 Woot Bux.<br> <b>Create New Single Panel Strip</b> - create a single panel of a comic strip. Another user will add the second panel and a third user will add the third. Three panels = a completed strip. All users who contribute a panel get credit and 25 Woot Bux.<br> <b>View Available 1 or 2-panel Strips</b> - if you wanna see the unfinished strips, click one of these choices to see them and to add a panel.<br><br> Please enter your <b>exact forum username</b> in the column marked username in order to receive Woot Bux for each submission. You will receive 4 Woot Bux for new complete submissions and 2 Woot Bux for each additional single-panel entry.<br><br> You have 2 options in submitting a Strip:<br><br> 1. <a href="http://www.wootability.com/draw/dessin.php">Click Here</a> to begin drawing your Strip using the WootPad. Upon completing your Strip, click the save button. Once saved, choose the number of your Strip in the dropdown menu and click edit, then click Viewing Mode at the top of the screen. In viewing mode, click "Convert file to .jpeg image" and save to your computer. Then upload that file in the form below in the column marked Strip Image File and complete the rest of the form.<br><br> 2. Open the MSPaint program on your computer (click Start - Programs - Accessories - Paint) and draw an image or skit to begin the process. Then upload that image and fill out the rest of the form. Anyone can try, no registration necessary! <br><br> <?php echo '<br /><a href="?new&complete">Create New Complete Strip</a><br /><a href="?new">Create New Single Panel Strip</a><br/> <a href="?list=1">View Available 1-Panel Strips</a><br/> <a href="?list=2">View Available 2-Panel Strips</a><br/><a href="?list=3">View Completed Strips</a><br/><a href="?latest">Top 5 Strips</a>'; } if(isset($list)){ title("List",'','',true); echo 'Menu:<br /><a href="?new&complete">Create New Complete Strip</a><br /><a href="?new">Cretae New Single Panel Strip</a><br/> <a href="?list=1">View Available 1-Panel Strips</a><br/> <a href="?list=2">View Available 2-Panel Strips</a><br/><a href="?list=3">View Completed Strips</a><br/><a href="?latest">Top 5 Strips</a><br/>'; if(!empty($list)){ $sql="select * from groupcomic where panels=$list and sid=parent"; if($list==3) $sql="SELECT y.*, (SUM(`rating`)/COUNT(`rating`)) AS `avg`, COUNT(`rating`) AS `num_rat` FROM `groupcomic` `y` LEFT JOIN `yrat` ON `sid` = `skey` where `panels`>=3 GROUP BY `sid` ORDER BY `avg` DESC"; $r=mysql_query($sql); $num_entrys=mysql_num_rows($r); $remain=$num_entrys % 4; $entrys_per_row=floor(($num_entrys-($remain))/4); //get average echo "<br /><center><table>"; for($i=1; $i<=$entrys_per_row;$i++) { echo "<tr>"; for($j=1;$j<=4;$j++){ $row=mysql_fetch_assoc($r); $id=$row['sid']; $avg=0; if($row['panels']>=3){ $avg=$row['avg']; } echo show_site($row['sid'], $row['title'], round($avg,2),$row['creator'],$row['file']); } /* if($i < $remain){ $row=mysql_fetch_assoc($r); echo show_site($row['sid'], $row['title'], round($row['avg'], 2),$row['user'],$row['image']); }*/ echo "</tr>"; } echo "<tr>"; while($row=mysql_fetch_assoc($r)){ $avg=0; if($row['panels']>=3){ $avg=$row['avg']; } echo show_site($row['sid'], $row['title'], round($avg,2),$row['creator'],$row['file']); } echo "</tr></table></center>"; } } if(isset($u)){ title("$u's Comics","$u's Comics",'',true); $sql="SELECT y.*, (SUM(`rating`)/COUNT(`rating`)) AS `avg`, COUNT(`rating`) AS `num_rat` FROM `groupcomic` `y` LEFT JOIN `yrat` ON `sid` = `skey` where creator='$u' GROUP BY `sid` ORDER BY `title` Asc"; $result=mysql_query($sql); $num_entrys=mysql_num_rows($result); $remain=$num_entrys % 4; $entrys_per_row=floor(($num_entrys-($remain))/4); echo "<br /><center><table>"; for($i=1; $i<=$entrys_per_row;$i++) { echo "<tr>"; for($j=1;$j<=4;$j++){ $row=mysql_fetch_assoc($result); $id=$row['sid']; $avg=0; if($row['panels']>=3){ $avg=$row['avg']; } $parz=$row['parent']; $sql="SELECT y.*, (SUM(`rating`)/COUNT(`rating`)) AS `avg`, COUNT(`rating`) AS `num_rat` FROM `groupcomic` `y` LEFT JOIN `yrat` ON `sid` = `skey` where sid='$parz' GROUP BY `sid` ORDER BY `title` Asc"; $r2=mysql_fetch_assoc(mysql_query($sql)); echo show_site($row['parent'], $r2['title'], round($r2['avg'],2),$row['creator'],$row['file']); } /* if($i < $remain){ $row=mysql_fetch_assoc($r); echo show_site($row['sid'], $row['title'], round($row['avg'], 2),$row['user'],$row['image']); }*/ echo "</tr>"; } echo "<tr>"; while($row=mysql_fetch_assoc($result)){ $avg=0; if($row['panels']>=3){ $avg=$row['avg']; } $parz=$row['parent']; $sql="SELECT y.*, (SUM(`rating`)/COUNT(`rating`)) AS `avg`, COUNT(`rating`) AS `num_rat` FROM `groupcomic` `y` LEFT JOIN `yrat` ON `sid` = `skey` where sid='$parz' GROUP BY `sid` ORDER BY `title` Asc"; $r2=mysql_fetch_assoc(mysql_query($sql)); echo show_site($row['sid'], $r2['title'], round($r2['avg'],2),$row['creator'],$row['file']); } echo "</tr></table></center>"; } if(isset($id) && !isset($list) && !isset($u)){ $q="select * from groupcomic where sid='$id'"; $result=mysql_query($q); $info=mysql_fetch_assoc($result); $title=$info['title']; $nsfw=$info['nsfw']; $npanels=$info['panels']; title($title); $q = mysql_query('SELECT * FROM `yrat` WHERE `skey` = \'' . mysql_real_escape_string($_GET['id']) . '\' AND `ip` = \'' . $_SERVER['REMOTE_ADDR'] . '\''); if(isset($_POST['rate'])) { if(mysql_num_rows($q) > 0) { $msg = 'You have already rated this site.'; } else { mysql_query('INSERT INTO `yrat` (`skey`, `rating`, `ip`) VALUES(\'' . mysql_real_escape_string($_GET['id']) . '\', ' . intval($_POST['rating']) . ', \'' . addslashes($_SERVER['REMOTE_ADDR']) . '\')') or die(mysql_error()); $msg = 'Rating successful.'; } } else { if(mysql_num_rows($q) > 0) { $q = mysql_query('SELECT SUM(`rating`), COUNT(`rating`) FROM `yrat` WHERE `skey` = \'' . mysql_escape_string($_GET['id']) . '\'') or die(mysql_error()); $r = mysql_fetch_row($q); $msg = 'Rating: '; if($r[0] == 0) { $msg .= '0.00'; } else { $msg .= round($r[0] / $r[1], 2); } } else { $msg = '<form action="' . $_SERVER['REQUEST_URI'] . '" method="post"> Rate this site: <select name="rating">'; for($i = 1; $i <= 5; $i++) { $msg .= "<option value='$i'>$i</option>\n"; } $msg .= ' </select> <input type="submit" value="Rate" name="rate" /> </form>'; } } //echo 'Menu:<br /><a href="?new&complete">Create New Complete Strip</a><br /><a href="">Create New Single Panel Strip</a><br/> <a href="?list=1">View Available 1-Panel Strips</a><br/> <a href="?list=2">View Available 2-Panel Strips</a><br/><a href="?list=3">View Completed Strips</a><br/><a href="?latest">Top 5 Strips</a><br /><br />'; if(!isset($pass) && $nsfw){ echo "This strip is NSFW! <a href=\"?pass&id=$id\">I affirm I am 18+</a>"; } else { $q2="select * from groupcomic where sid='$id' or parent='$id' order by id asc"; $res2=mysql_query($q2); $comic=mysql_fetch_array($res2); $title=$comic['title']; $maintitle=$title; $author=$comic['creator']; $authors="<a href=?u=$author>$author</a>"; $imagesrc=$comic['file']; $key=$comic['sid']; if($npanels!=4) {$something="height=400 width=350";} else { $something="";} echo "<table><tr><td><img $something ALT=\"$title\" src=\"$imagesrc\"><br /><center><a href=?u=$author>$author</a></center></td>"; $i=1; while($comic=mysql_fetch_array($res2)){ $title=$comic['title']; $author=$comic['creator']; $imagesrc=$comic['file']; $id=$comic['sid']; $authors.=", <a href=?u=$author>$author</a>"; $i++; echo "<td><img ALT=\"$title\" height=400 width=350 src=\"$imagesrc\"><br /><center><a href=?u=$author>$author</a></center></td>"; } echo "</tr></table><br/>"; if($npanels<3){ $nextpan=$npanels+1; echo "<center><a href=\"?new&parent=$key&npan=$nextpan\">Create New Panel for this strip</a></center>"; } else { echo $part1 ."<table><tr><td colspan=2>". $msg ."</td><td width=225 align=right><a href=\"com_comments.php?id=$id\" target=\"new\">View/Add Comments</a></td></tr><tr><td>Title:<br />Author:</td><td>$maintitle<br />$authors<br /></td></tr></table>". $part2; echo "<center>Strip Is CLOSED!</center>"; } } } if(!isset($_POST['add']) && !isset($id) & !isset($list) & isset($new)){ title("New Strip", "New Strip",'',true); echo 'Menu:<br /><a href="?new&complete">Create New Complete Strip</a><br /><a href="?new">Create New Single Panel Strip</a><br/> <a href="?list=1">View Available 1-Panel Strips</a><br/> <a href="?list=2">View Available 2-Panel Strips</a><br/><a href="?list=3">View Completed Strips</a><br/><a href="?latest">Top 5 Strips</a><br /><br />'; ?> <form action="" method="post" name="hi" enctype="multipart/form-data"> <?php $nodisp=''; if(isset($parent)){ $par=$parent; $nodisp="style='display:none;'";} else { $npan=''; $par=''; echo "Choose a Title for your Strip: "; } echo "<input type=\"text\" $nodisp name=\"title\" value=\"$par$npan\">"; ?> (20 character limit) <script> displaylimit("document.hi.title","",20) </script><br /> Your UserName: <input type="text" name="username" value="" /> (15 character limit - use exact Forum log-in name) <script> displaylimit("document.hi.username","",15) </script><br /> The Strip image file: <input type="file" id="image" name="image" /><br /> <?php if(isset($complete)){ echo "<input type=\"hidden\" name=\"complete\" value=\"true\">"; } if(!isset($parent)) $parent=""; echo "<input type=\"hidden\" name=\"parent\" value=\"$parent\">" ?> <input type="checkbox" name="nsfw" id="nsfw" value="1" /> <label for="nsfw" title="Not Safe For Work">NSFW</label><br /> <input type="submit" name="add" value="Submit Comix!" /> </form> <?php }elseif(isset($_POST['add'])){ title("Strip Submitted",'','',true); //echo 'Menu:<br /><a href="?new&complete">Create New Complete Strip</a><br /><a href="?new">Create New Single Panel Strip</a><br/> <a href="?list=1">View Availeable 1-Panel Strips</a><br/> <a href="?list=2">View Available 2-Panel Strips</a><br/><a href="?list=3">View Completed Strips</a><br/><a href="?latest">Top 5 Strips</a><br /><br />'; $key = strtolower(preg_replace('#[^a-zA-Z0-9\-]#', '', str_replace(array(' ', '_'), '-', $_POST['title']))); $query="select * from groupcomic where parent='$key'"; if(isset($_POST['complete'])) {$pnum=4;}else{$pnum=1;} $numrows=mysql_num_rows(mysql_query($query)); $errors = array( 'Please choose another title' => (strlen($key) < 1 || mysql_num_rows(mysql_query('SELECT * FROM `groupcomic` WHERE `sid` = \'' . $key . '\'')) > 0), 'Error with upload - make sure that you are uploading an allowed type of image and/or music' => upload($key,1), 'Please submit an image' => strlen($_FILES['image']['name']) < 1, 'There are already 3 panels to this strip' => $numrows==3, 'Invalid username' => strlen($_POST['username']) < 1, ); if(in_array(true, $errors)) { echo "<h2>Error</h2>\n"; foreach($errors as $msg => $v) { if($v) { echo "<h3>" . $msg . "</h3>"; } } }else{ $creator=htmlspecialchars($_POST['username']); $title=htmlspecialchars($_POST['title']); $added=time(); $parent=$_POST['parent']; if(!empty($parent)){ $sql="update groupcomic set panels = panels+1 where sid='$parent'"; mysql_query($sql); } else { $parent=$key; } $imgfile=$_GET['new_image']; $nsfw=(isset($_POST['nsfw']) ? 1 : 0); $q ="insert into groupcomic (sid, title, creator, added, panels, nsfw, file, parent) values ('$key', '$title', '$creator', $added, $pnum, $nsfw, '$imgfile', '$parent')"; // echo "$q"; mysql_query($q) or die('Error in SQL.<br />' . mysql_error() . '<br />' . $q); $user=$_POST['username']; if(isset($_POST['complete'])){ $padd=25;}else{$padd=10;} $sql="update ibf_members set points=points+$padd where name='$creator'"; mysql_query($sql); echo 'Thank you for your submission. If you entered your forum username in correctly, you will be awarded Woot Bux. If you do not have a forum username, you will not be awarded any Bux, but you can <a href="http://www.wootability.com/Woot">Click Here</a> to register.'; die('<h2>Success!</h2> You have submitted your site. <a href="?id=' . $parent . '">Click here to be taken to it.</a>'); } } if($ADMIN) { if(isset($_GET['key'])) { $k = $_GET['key']; echo '<h2>Editing ' . $k . "</h2>\n"; if(isset($_GET['del'])) { mysql_query('update groupcomic set panels=panels-1 where sid=\'' . addslashes($p) . '\''); mysql_query('DELETE FROM `groupcomic` WHERE `sid` = \'' . addslashes($k) . '\''); mysql_query('update groupcomic set parent=\'\' where parent=\'' . addslashes($k) . '\''); echo $k . ' was deleted'; } else { echo 'Are you sure you want to delete? <a href="?key=' . $k . '&p='.$p.'&del">Yes</a>'; } echo '<br /><a href="?">Go Back</a>'; } else { if(isset($_GET['logout'])) { setcookie('lol', '', 1); header('location: ?'); } echo "<h2>Current Comix</h2>\n"; $q = mysql_query('SELECT * FROM `groupcomic`'); while($r = mysql_fetch_assoc($q)) { echo '<a href="?id=' . $r['sid'] . '">' . $r['title'] . '</a> - <a href="?key=' . $r['sid'] . '&p='.$r['parent'].'"' . ">Delete</a><br />\n"; } echo '<h3><a href="?logout">Logout</a></h3>'; } } ?>
  11. I was wondering if anyone could help me - I have a PHP script. I know it works, but I'm not sure of the SQL table structure that I have to create in order for it to work properly. I was wondering if anyone could help me? I'll attach the file(s) to this message. Any help is greatly appreciated.
  12. Never mind, I got it. Thanks!
  13. Hi, my PHP skills are kinda weak and I've been trying to get this to work, but for some reason, the href isn't linking properly. Can anyone help me with this? $titlehigh = preg_replace ( "'($var)'si" , "<strong> \1</strong>" , $row_linkcat[ 'sid' ] ); $linkhigh = preg_replace ( "'($var)'si" , "<strong> \1</strong>" , $row_linkcat[ 'title' ] ); $linkdesc = preg_replace ( "'($var)'si" , "<strong> \1</strong>" , $row_linkcat[ 'creator' ] ); $filehigh = preg_replace ( "'($var)'si" , "<strong> \1</strong>" , $row_linkcat[ 'file' ] ); $linkpic = preg_replace ( "'($var)'si" , "<strong> \1</strong>" , $row_linkcat[ 'parent' ] ); foreach($trimmed_array as $trimm){ if($trimm != 'b' ){ $titlehigh = preg_replace( "'($trimm)'si" , "<strong> \1</strong>" , $titlehigh); } //end highlight ?> <p> <center> <?php echo "<a href='http://www.wootability.com/WootStrips/newstrips.php?id='" . $linkpic . "'>$linkhigh</a>"; ?><br /> For some reason, the href is just a blank id. I'd be very appreciate if anyone could help. Thanks!
  14. So I have this snippet of code: $row['ratings'] = ""; $ratingsSQL = $this->ipsclass->DB->query( "SELECT `pid` , `rating` , COUNT(`rating`) as ratings FROM `ibf_ratings` WHERE `pid` = '" . $row['pid'] . "' GROUP BY `rating` "); $i = 0; $ratingshtml = ""; if( $this->ipsclass->DB->get_num_rows( $ratingsSQL ) ) { while( $rrow = $this->ipsclass->DB->fetch_row( $ratingsSQL ) ) { $ratingshtml .= "<div class=\"rate_it_display\" style=\"background-image: url( 'style_images/rate/" . str_replace( ' ' , '' , strtolower( $this->ratings[$rrow['rating']] ) ) . ".png' ) \"> " . $rrow['ratings']. " x " . $this->ratings[$rrow['rating']] . "!</div>"; $i++; } $ratingshtml .= "<a href=\"#\" onclick=\"return RateItExpand( {$row['pid']} );\" style=\"color: #999;\">(list)</a>"; } $row['ratings'] = $this->ipsclass->compiled_templates['skin_topic']->ratings( $row['pid'] , $row['author_id'] , $ratingshtml ); I want to add an if statement to the code so that the ratings won't load unless a user clicks a button at the top of the screen. Can anyone help me with this? I'd be very appreciative. Thanks in advance.
×
×
  • 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.