Jump to content

NealeWeb

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

Everything posted by NealeWeb

  1. Hi guys and wow, thanks for all the replies but while i was away waiting i was just playing with the code, changing things to see if i could get it to work and i found that it actually isnt the query thats the problem its something else i have on the page. I have a small page transition script that i found on the internet and when i removed it, it all worked fine. So now i just need to figure out why it is affecting my page as it only happens when i try to submit a form. Here is the script: <script type="text/javascript"> (function inittrans() { var params = //All params are optional, you can just assign {} { "navB" : "slide reverse", //Effect for navigation button, leave it empty to disable it "but" : true, //Flag to enable transitions on button, false by default "cBa" : onTransitionFinished // function() { alert("Done!"); } //callback function }; new ft(params); })(); function onTransitionFinished() { //Do anything you want } </script> And in all my links i have, data-ftrans="slide" after the href. I got the script from here: http://www.fasw.ws/faswwp/non-jquery-page-transitions-lightweight/ Any ideas?
  2. Hi guys i am trying to search results from a database using SELECT * FROM table_name WHERE event LIKE '%" . $search . "%' OR date LIKE '%" . $search . "%' This works fine in Firefox and in IE, but when i try it in safari, it seems to pull up the right results but then straight away changes and gives me all the results from the table. I am sure it has soomething to do with the LIKE operator because when i tried SELECT * FROM table_name WHERE date = (the date i was trying to search for) It worked fine. So the only difference was i just manually told it what to look for. And it worked
  3. the connecct info is definatley ok as sometimes it works fine
  4. The code below is in a php file thats included (<?php include(messages.php); ?>) in a div thats refreshed every 5 mins using javascript. <?php $dbHost = "localhost"; $dbUser = "#####"; $dbPass = "#####"; $dbname = "#####"; $db = mysql_connect($dbHost,$dbUser,$dbPass); mysql_select_db($dbname,$db); mysql_query("UPDATE members SET active=NOW() WHERE member_id = '$_SESSION[sESS_MEMBER_ID]'"); $requete = "SELECT * FROM public_messages ORDER BY id desc"; $result = mysql_query ($requete,$db); while($row = mysql_fetch_array($result)) { $msg = str_replace ("\r\n", '<br />', $row['message']); $msg = str_ireplace($badwords,'<span class="censored">[Censored]</span>',$msg); $author = $row['author']; $dateandtime = $row['date_time']; $mid = $row['msg_id']; $aid = $row['auth_id']; $cmnts = $row['comments']; echo "<div class=\"msg_box\"><!--Start msg_box --> <img class=\"avatar\" src=\"users/$author/avatar.jpg\" /> <span class=\"msgblue\">$author</span><br /> <span class=\"msgdark\">$msg</span> <div class=\"msg_footer\"> <div class=\"footer_left\"> <span class=\"posted\">Posted: </span><span class=\"posted_date_time\">$dateandtime</span> </div> <div class=\"footer_right\"> <a href=\"messagecomments.php?msgid=$mid\"><span class=\"msg_options\">Comments ($cmnts)</span></a> <img class=\"bubble\" src=\"images/speechbubble.png\" />"; if ($_SESSION['SESS_MEMBER_ID'] == $aid) { echo "<a href=\"edit_message.php?msgid=$mid\" onclick=\"return confirm('You are about to edit this message.');\"><img class=\"edit\" src=\"images/edithover.png\" /></a><a href=\"deletemessage.php?msgid=$mid\" onclick=\"return confirm('You are about to delete this message.');\"> <img class=\"delete\" src=\"images/deletehover.png\" /></a>"; } else { echo "<a href=\"reportmessage.php?msgid=$mid&activeuser=$activeuser\" onclick=\"return confirm('You are about to anonymously report this message as unsuitable.');\"><img class=\"report\" src=\"images/report.png\" /></a>"; } echo " </div> </div></div><!--End msg_box -->"; } mysql_close($db); ?>
  5. Im making a site for my family to leave messages for everyone to see but every now and then the message wont load and i get theses errors, Warning: mysql_connect() [function.mysql-connect]: Too many connections in /home/#####/public_html/#####.com/messages.php on line 17 Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/#####/public_html/#####.com/messages.php on line 18 Warning: mysql_query() [function.mysql-query]: Access denied for user '#####'@'localhost' (using password: NO) in /home/#####/public_html/#####.com/messages.php on line 21 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/#####/public_html/#####.com/messages.php on line 21 Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/#####/public_html/#####.com/messages.php on line 24 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/#####/public_html/#####.com/messages.php on line 25 Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /home/#####/public_html/#####.com/messages.php on line 54 i also recieved this error once Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) The hosting support team have been no help at all.
  6. I have no idea what im doing wrong but this just isnt working, theres no error messages but im not getting any of the emails. Here is all the code that i had anything to do with editing, i have removed any personal info from it. <?php $dbhost = 'localhost'; $dbuser = ' '; $dbpass = ' '; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); mysql_select_db(" ", $conn); $result = mysql_query("SELECT ****, ********** FROM **** WHERE name='*****'"); while($row = mysql_fetch_array($result)) { $message = "<p><u><b><font size=\"5\" color=\"#800080\">********************</font></b></u></p> <p><b><font color=\"#800080\" size=\"4\">**************************************************</font></b></p> <p><b><font color=\"#800080\">*********</font></b> <b><font color=\"#333333\">**********</font></b></p> <p><b><font color=\"#800080\">********</font></b> <font color=\"#333333\"><b>***********</b></font></p> <p><font color=\"#800080\"><b>*******</b></font> <font color=\"#333333\"><a href=\"***********************************************</a></font></p> <p> </p>"; } $query=mysql_query('SELECT `email`,`name` FROM `users`'); //grab emails and names from database while($row = mysql_fetch_array($query)) //start a loop to send an email to each individual { //mail function with $row['email'] as the email address //I'm using phpmailer as an example here - - > include_once('phpMailer/class.phpmailer.php'); $mail = new PHPMailer(); // defaults to using php "mail()" $body = $message; //message inside the email $mail->From = "**************"; //email address that the email is being sent from $mail->FromName = "*************"; //more in depth for who the mail is from. $mail->Subject = "***********************************"; //The subject for the message //$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $mail->AddAddress($row[email], $row['name']); } mysql_close($conn); ?>
  7. Ok sorry onne more thing i am trying to use this in an existing echo but im having trouble. I get this error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' on line 48 This is what i have tried: echo '<div align="center"> <table border="0" cellpadding="10" cellspacing="0" width="969" background="imgs/reviewbox.png" height="157"> <tr> <td height="19" ><span class="font1">' . $jtitle . '</span></td> <td height="19" > <p align="right"><a href="review.php?review_id=' . $revid . '"><span class="font">View Full review</span></a></td> </tr> <tr> Line 48 >>> <td valign="top" colspan="2"><span class="font">substr($t,0,, (strlen($t) > ? ' <a href="yourlink">Read more...</a>' : '';</span></td> <<< Line 48 </tr> </table> </div>'; Is it possible to make it a variable like this in any way: <?php $t = "Your text"; $y= substr($t,0,, (strlen($t) > ? ' <a href="yourlink">Read more...</a>' : ''; echo $y; ?> I am very new at php so im sure im making some pretty silly mistakes.
  8. Wow that is perfect it works great thankyou so much
  9. I am wanting to display large text blocks from a database but i would like to stop the text if its longer than 600 characters and display Read more... as a link. Can someone please help me?
  10. Ok great no error anymore thankyou but im now getting a blank page with no results. Any idea what i did wrong?
  11. Thankyou for the help but i am now getting this error Parse error: syntax error, unexpected $end in /members.php on line 31 members.php <?php session_start(); require 'database.php'; $nuser=$_SESSION['user']; $auser=$_SESSION['admin']; if($nuser){ $userfinal=$nuser; }elseif($auser){ $userfinal=$auser; } if(isset($userfinal)){ $Members = mysql_query("SELECT user FROM characters WHERE level ='1' ORDER BY exp DESC") or die(mysql_error()); ?> <table border="0"> <?php while($name = mysql_fetch_assoc($Members)) { ?> <tr> <?php echo "<td><a href=\"member_profile.php?user=" . $name['user'] . "\">" . $name['user'] . "</a></td>"; ?> </tr> <?php } ?> </table> <<<<<<<<<< Line 31
  12. I am following a tutorial and have come across an error, i have checked that i made no mistakes when copying and have tried everything i know to try but im not that experienced so ive had no luck. Could someone pls point out the mistake for me. Parse error: syntax error, unexpected $end in /members.php on line 30 members.php <?php session_start(); require 'database.php'; $nuser=$_SESSION['user']; $auser=$_SESSION['admin']; if($nuser){ $userfinal=$nuser; }elseif($auser){ $userfinal=$auser; } if(isset($userfinal)){ $Members = mysql_query("SELECT user FROM characters WHERE level ='1' ORDER BY exp DESC") or die(mysql_error()); $numRowsMembers = mysql_num_rows($Members); ?> <table border="0"> <?php for($count = 1; $count <= $numRowsMembers; $count++) { $name = mysql_fetch_array($Members); ?> <tr> <?php echo '<td><a href="member_profile.php?username=' . $name['user'] . '">' . $name['user'] . '</a></td>'; ?> </tr> <?php <<<<<<<<<< Line 30 } ?> </table>
  13. Ok this time i managed to get it to display the results correctly but now i can only get the first page, when i go to next page it says not found. Here is the code and the link: http://www.nealeweb.com/steven2/ <?php $rpp = 24; // results per page $adjacents = 4; $page = intval($_GET["page"]); if($page<=0) $page = 1; $reload = $_SERVER['PHP_SELF']; $dbhost = "localhost"; $dbuser = ""; $dbpass = ""; $dbname = ""; // connect to your DB: $link_id = mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error()); mysql_select_db($dbname, $link_id); // select appropriate results from DB: $sql = "SELECT * FROM tracks ORDER BY cat_id asc"; $result = mysql_query($sql, $link_id); // count total number of appropriate listings: $tcount = mysql_num_rows($result); // count number of pages: $tpages = ($tcount) ? ceil($tcount/$rpp) : 3; // total pages, last page number $count = 0; $i = ($page-1)*$rpp; while(($count<$rpp) && ($i<$tcount)) { mysql_data_seek($result,$i); $row = mysql_fetch_array($result); $catno = $row['cat_id']; $songname = $row['song']; $artistname = $row['artist']; $ryear = $row["year"]; // output each row: echo'<tr> <td valign="top" width="112" height="27"><span class="font">'.$catno.'</span></td> <td valign="top" width="536" height="27"><span class="font">'.$songname.'</span></td> <td valign="top"><span class="font" height="27">'.$artistname.'</span></td> <td valign="top" width="80" height="27"><span class="font">'.$ryear.'</span></td> </tr>'; $i++; $count++; } include("pagination3.php"); echo paginate_three($reload, $page, $tpages, $adjacents); ?>
  14. I am building my uncle an online music catalogue and am trying to use pagination http://www.phpeasycode.com/pagination/ but for some reason it is only showing the cat_id data from the databse and even then its only the last entry. I need it to show all cat_id, song, artist and year from the database and not just the same ones over and over again. Here is a link to the page so you can see whats happening: http://www.nealeweb.com/steven2/ And here is the code, Can anybody tell me where i have gone wrong please. $rpp = 24; // results per page $adjacents = 4; $page = intval($_GET["page"]); if($page<=0) $page = 1; $reload = $_SERVER['PHP_SELF']; // connect to your DB: $dbHost = ""; $dbUser = ""; $dbPass = ""; $dbname = ""; $db = mysql_connect($dbHost,$dbUser,$dbPass); mysql_select_db($dbname,$db); // select appropriate results from DB: $requete = "SELECT cat_id, song, artist, year FROM tracks ORDER BY cat_id asc"; $result = mysql_query ($requete,$db); // count total number of appropriate listings: $tcount = mysql_num_rows($result); // count number of pages: $tpages = ($tcount) ? ceil($tcount/$rpp) : 1; // total pages, last page number $count = 0; $i = ($page-1)*$rpp; while(($count<$rpp) && ($i<$tcount)) { mysql_data_seek($result,$i); $query = mysql_fetch_array($result); // output each row: echo'<tr> <td valign="top" width="112" height="27"><span class="font">'.$catno.'</span></td> <td valign="top" width="536" height="27"><span class="font">'.$songname.'</span></td> <td valign="top"><span class="font" height="27">'.$artistname.'</span></td> <td valign="top" width="80" height="27"><span class="font">'.$ryear.'</span></td> </tr>'; $i++; $count++; } // call pagination function: include("paginate.php"); echo paginate_three($reload, $page, $tpages, $adjacents);
  15. I have a guestbook and i want to record and display the time of each post but at the moment all the times are added to the database including seconds so it looks like this - 05:42:33, i just want the hours and minutes like this - 05:42. This is the code that adds the time. $time = date("HH:MM"); $db = mysql_connect($dbHost,$dbUser,$dbPass); mysql_select_db($dbname,$db); $sql="INSERT INTO guestbook (`time`) VALUES ( And this is the code that displays it <?php $db = mysql_connect($dbHost,$dbUser,$dbPass); mysql_select_db($dbname,$db); $requete = " time FROM guestbook ORDER BY ID desc LIMIT 1"; $result = mysql_query ($requete,$db); while($row = mysql_fetch_assoc($result)) { $time = $row["time"]; echo '<span class="font2">'.''.$time.''.'</span>'; } ?> Can anybody help me.
  16. I am simply trying to display the last 8 images from a mysql database and i am getting this error: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/aretheyh/public_html/nealeweb.com/gnew2/recent.php on line 8 Can somebody please tell me what i am doing wrong. <?php $i = 1; echo '<table border="0" cellpadding="0" cellspacing="0"> <tr>'; include("config.inc.php"); $result = mysql_query("SELECT * FROM gallery_photos ORDER BY id DESC LIMIT 8"); while($row = mysql_fetch_assoc($result)) { // Start of the loop $img = $row['".$images_dir."/tb_']; echo "<td><img src=$img></td>"; if ($i == 4) { echo '</tr><tr>'; } $i++; } echo '</tr></table>';
  17. All i need is someone to tell me how i can get the code below to also display a single thumbnail from the category above the category name. Category and Thumbnail listing code... if( empty($cid) && empty($pid) ) { $number_of_categories_in_row = 4; $result = mysql_query( "SELECT c.category_id,c.category_name,COUNT(photo_id) FROM gallery_category as c LEFT JOIN gallery_photos as p ON p.photo_category = c.category_id GROUP BY c.category_id "); while( $row = mysql_fetch_array( $result ) ) { $result_array[] = '<a href="gallery.php?cid=' . $row[0] . '">' . $row[1] . '</a> (' . $row[2] . ')'; } mysql_free_result( $result ); $result_final = "<tr>\n"; foreach($result_array as $category_link) { if($counter == $number_of_categories_in_row) { $counter = 1; $result_final .= "\n</tr>\n<tr>\n"; } else $counter++; $result_final .= "\t<td>".$category_link."</td>\n"; } if($counter) { if($number_of_categories_in_row-$counter) $result_final .= "\t<td colspan='".($number_of_categories_in_row-$counter)."'> </td>\n"; $result_final .= "</tr>"; } } // Thumbnail Listing else if( $cid && empty( $pid ) ) { $number_of_thumbs_in_row = '1'; $result = mysql_query( "SELECT photo_id,photo_caption,photo_filename FROM gallery_photos WHERE photo_category='".addslashes($cid)."'" ); $nr = mysql_num_rows( $result ); if( empty( $nr ) ) { $result_final = "\t<tr><td>No Gallery found</td></tr>\n"; } else { while( $row = mysql_fetch_array( $result ) ) { $result_array[] = "<a href='".$images_dir."/full_".$row[2]."' rel=\"lightbox\"><img src='".$images_dir."/tb_".$row[2]."' border='3' style='margin: 4px;' bordercolor='silver' alt='".$row[1]."' /></a>"; } mysql_free_result( $result ); $result_final = "<tr>\n"; foreach($result_array as $thumbnail_link) { if($counter == $number_of_thumbs_in_row) { $counter = 1; $result_final .= "\n</tr>\n<tr>\n"; } else $counter++; $result_final .= $thumbnail_link; } if($counter) { if($number_of_photos_in_row-$counter) $result_final .= "\t<td colspan='".($number_of_photos_in_row-$counter)."'> </td>\n"; $result_final .= "</tr>"; } } } the link below is to the page that lists the categories, when you click on a category it shows you all the thumbnails, i want to be able to show any one of those thumbnails above the category name in the list of categories. Im sure it must be really simple but nothing im trying is working. http://www.nealeweb.com/auto2/gallery.php Please help!
  18. Ok i have tried a few things and have had no luck, i am a begginer so i could do with some schooling, below is the code that generates a list of galleries and the number of images in that gallery, what i want is to be able to display a thumbnail that i upload every time i make a new gallery above the gallery name in the list (the code for adding a new gallery is also below) i need help altering my database to make a place for the uploaded thumbnails and also modifying the code that generates the gallery list in order to display the thumbnails and also the add new category form to upload the image. Category Listing... (This is it live at the moment) <?php // initialization $result_array = array(); $counter = 0; $cid = (int)($_GET['cid']); $pid = (int)($_GET['pid']); // Category Listing if( empty($cid) && empty($pid) ) { $number_of_categories_in_row = 4; $result = mysql_query( "SELECT c.category_id,c.category_name,COUNT(photo_id) FROM gallery_category as c LEFT JOIN gallery_photos as p ON p.photo_category = c.category_id GROUP BY c.category_id" ); while( $row = mysql_fetch_array( $result ) ) { $result_array[] = '<a href="gallery.php?cid=' . $row[0] . '">' . $row[1] . '</a> (' . $row[2] . ')'; } mysql_free_result( $result ); $result_final = "<tr>\n"; foreach($result_array as $category_link) { if($counter == $number_of_categories_in_row) { $counter = 1; $result_final .= "\n</tr>\n<tr>\n"; } else $counter++; $result_final .= "\t<td>".$category_link."</td>\n"; } if($counter) { if($number_of_categories_in_row-$counter) $result_final .= "\t<td colspan='".($number_of_categories_in_row-$counter)."'> </td>\n"; $result_final .= "</tr>"; } } Add new category... (This is it live at the moment) <?php if (isset($_POST['submit'])): $category_name = $_POST['category_name']; mysql_query( "INSERT INTO gallery_category(`category_name`) VALUES('".addslashes( $category_name )."' )" ); if (@mysql_query($sql)) { echo('<p>New category added</p>'); } else { echo('<p>New category added</p>'); } ?> <p><a href="<?=$_SERVER['PHP_SELF']?>">Add another category</a></p> <?php else: // Allow the user to enter a new category ?> <form action="<?=$_SERVER['PHP_SELF']?>" method="post"> <p><br /> New Category: <input type="text" name="category_name" size="20" maxlength="255"/><br /> <input type="submit" name="submit" value="SUBMIT" /></p> </form> <?php endif; ?> And this is how id like them to look when finished... Gallery Listing Add new category
  19. I dont know if this will help you help me but this is the tutorial i have been following and all i need is a way to be able to show the list of categories with a thumbnail image that i upload when adding new categories, its frustrating because for days i have been pulling my hair out because i know it would just take a few more lines of code on the viewgallery.php page and on the page where i add new categories and maybe a new table or some fields in the database but i cant do any of it. i feel so stupid. http://articles.sitepoint.com/article/php-gallery-system-minutes
  20. I have yes, i have installed joomla, drupal, gallery, gallerific, zenphoto, 4images, wordpress, coppermine, tiny webgallery, piwigo, phpalbum and MANY more thinking that i will somehow be able to integrate in with my design but same as always as soon as they are installed im at a dead end, i have no idea what to do next, i have been through the pages of code seeing if i can spot which parts to copy or how to insert my design but i never get any where, i barely understand any of the code i am still only part way through the chapters on the w3schools site. I know i have no right expecting to be able to do this with the little i have learned so far but im trying allday everyday and i just need a break.
  21. Ok i didnt expect that image to be so big. Anyway that is how i need it to look, or at least very close to that. And with my limited experience integrating all the code from something like zenphoto into this design seems impossible, i would not have a clue where to start.
  22. I started learning web design a while ago and i made the mistake of promising my cousin a site and designed it the way he wanted it because i thought i would be able to do it but i guess i should have been sure before i made any promises but its too late for that and i just dont want to let him down now. This is the way i need it to look... And this is the basic plan i came up with for the site... Gallery Page: List of galleries(Thumbnail for each gallery), inside galleries = image thumbnails with individual image rating and commenting with a jquery plugin preview to view large images. Manage Site Page: (link echoed after log in) > multiple image upload into selected gallery(category), option to add a new gallery(category) and change photo or text on home and about page. Contact page: email form (I can do this). About page: changeable photo and page text. Home page: changeable page text. Login form on each page, when logged in stay on same page but show link to manage site page below a welcome user message where the form was.
  23. The actual gallery images are stored in folders because i followed a tutorial to make the gallery but i am trying to modify it on my own, tahts why some are stored in folders and some in the database, also i would love to be able to use a script like zenphoto or gallery or something similar i have downloaded and attempted neaarly all of them but i have a site design that i need to be able to fit one of those scripts into and that seems like an even harder challenge than learning all the code from scratch.
  24. No need, i just checked and they are definatley stored in the database. Does this mean that what im trying to do will not work.
  25. I am very new so i could be wrong but i am pretty sure im storing the actual image in the database, i know its not advised, but this whole thing is taking me ages to learn and that was the first way that worked for me.
×
×
  • 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.