Jump to content

blink359

Members
  • Posts

    169
  • Joined

  • Last visited

    Never

About blink359

  • Birthday 06/01/1994

Contact Methods

  • MSN
    nathan_wow_boothby_1994@hotmail.com

Profile Information

  • Gender
    Male
  • Location
    England

blink359's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. It was disabled but do you mean? If so, what do I need to do to set it up correctly?
  2. Topic moving away from PhP now :/ I get 401 - Unauthorized: Access is denied due to invalid credentials.
  3. echo ">male; is missing close quotation echo ">male";
  4. Hi, I am trying to get the local windows username on the domain PC's on our intranet, I have tried $_SERVER['LOGON_USER'] but it doesn't seem to work, How can I go about doing this. Regards, Nathan
  5. Hi there, having a few problems with my pagination script firstly i get an error "mysql_fetch_array(): supplied argument is not a valid MySQL result resource " before it was doing that all the time (it was doing it on/off for a bit) my search feature didnt seem to be narrowing down the results, Here is my code: <?php //mysql connect is here $name = $_POST['name']; $county = $_POST['county']; $town = $_POST['town']; $max = 10; //amount of articles per page. change to what to want $p ="1"; $p = $_GET['p']; $pp = $p -1; $np = $p +1; $limits = ($p - 1) * $max; //view the news article! if(!$name || !$county || !$town){ $sql = mysql_query("SELECT * FROM pusers LIMIT ".$limits.",$max"); $totalres = mysql_result(mysql_query("SELECT COUNT(id) AS tot FROM pusers"),0); $totalpages = ceil($totalres / $max); $nplimit = $totalpages; $nplimit++; while($info = mysql_fetch_array($sql)){ echo $info['pname']; echo '<br>'; echo $info['ptown']; } echo'<br>'; if($pp =="0"){ echo(''); }else{ echo'<a href="publist.php?p='. $pp .'">'. Previous .'</a> '; } for($i = 1; $i <= $totalpages; $i++){ echo'<a href="publist.php?p='. $i .'">'. $i .'</a> '; } if($np == $nplimit){ echo(''); }else{ echo'<a href="publist.php?p='. $np .'">'. Next .'</a> '; } }else{ $sql =""; if($name !=""){ $searchsplit = explode(" ", $pubname); $searchsplit0 = $searchsplit['0']; $searchsplit1 = $searchsplit['1']; $searchsplit2 = $searchsplit['2']; $searchsplit3 = $searchsplit['3']; $searchsplit4 = $searchsplit['4']; $searchsplit5 = $searchsplit['5']; $searchsplit6 = $searchsplit['6']; $searchsplit7 = $searchsplit['7']; $searchsplit8 = $searchsplit['7']; $searchsplit9 = $searchsplit['9']; if($searchsplit0 =="the" || $searchsplit0 =="The" || $searchsplit0 =="of" || $searchsplit0 =="Of" || $searchsplit0 =="and" || $searchsplit0 =="And" || $searchsplit0 ==""){ $use0 ="no"; } if($searchsplit1 =="the" || $searchsplit1 =="The" || $searchsplit1 =="of" || $searchsplit1 =="Of" || $searchsplit1 =="and" || $searchsplit1 =="And" || $searchsplit1 ==""){ $use1 ="no"; } if($searchsplit2 =="the" || $searchsplit2 =="The" || $searchsplit2 =="of" || $searchsplit2 =="Of" || $searchsplit2 =="and" || $searchsplit2 =="And" || $searchsplit2 ==""){ $use2 ="no"; } if($searchsplit3 =="the" || $searchsplit3 =="The" || $searchsplit3 =="of" || $searchsplit3 =="Of" || $searchsplit3 =="and" || $searchsplit3 =="And" || $searchsplit3 ==""){ $use3 ="no"; } if($searchsplit4 =="the" || $searchsplit4 =="The" || $searchsplit4 =="of" || $searchsplit4 =="Of" || $searchsplit4 =="and" || $searchsplit4 =="And" || $searchsplit4 ==""){ $use4 ="no"; } if($searchsplit5 =="the" || $searchsplit5 =="The" || $searchsplit5 =="of" || $searchsplit5 =="Of" || $searchsplit5 =="and" || $searchsplit5 =="And" || $searchsplit5 ==""){ $use5 ="no"; } if($searchsplit6 =="the" || $searchsplit6 =="The" || $searchsplit6 =="of" || $searchsplit6 =="Of" || $searchsplit6 =="and" || $searchsplit6 =="And" || $searchsplit6 ==""){ $use6 ="no"; } if($searchsplit7 =="the" || $searchsplit7 =="The" || $searchsplit7 =="of" || $searchsplit7 =="Of" || $searchsplit7 =="and" || $searchsplit7 =="And" || $searchsplit7 ==""){ $use7 ="no"; } if($searchspli8 =="the" || $searchspli8 =="The" || $searchspli8 =="of" || $searchspli8 =="Of" || $searchspli8 =="and" || $searchspli8 =="And" || $searchspli8 ==""){ $use8 ="no"; } if($searchsplit9 =="the" || $searchsplit9 =="The" || $searchsplit9 =="of" || $searchsplit9 =="Of" || $searchsplit9 =="and" || $searchsplit9 =="And" || $searchsplit9 ==""){ $use9 ="no"; } if($searchsplit1 =="" & $searchsplit2 =="" & $searchsplit3 =="" & $searchsplit4 =="" & $searchsplit5 =="" & $searchsplit6 =="" & $searchsplit7 =="" & $searchsplit8 =="" & $searchsplit9 ==""){ $use0="no"; } $sql ='SELECT FROM pusers WHERE pname LIKE \''. $pubname .'\''; if($use0 !="no"){ $sql =''.$sql .' OR pname LIKE \''. $searchsplit0 .'\''; } if($use1 !="no"){ $sql =''.$sql .' OR pname LIKE \''. $searchsplit1 .'\''; } if($use2 !="no"){ $sql =''.$sql .' OR pname LIKE \''. $searchsplit2 .'\''; } if($use3 !="no"){ $sql =''.$sql .' OR pname LIKE \''. $searchsplit3 .'\''; } if($use4 !="no"){ $sql =''.$sql .' OR pname LIKE \''. $searchsplit4 .'\''; } if($use5 !="no"){ $sql =''.$sql .' OR pname LIKE \''. $searchsplit5 .'\''; } if($use6 !="no"){ $sql =''.$sql .' OR pname LIKE \''. $searchsplit6 .'\''; } if($use7 !="no"){ $sql =''.$sql .' OR pname LIKE \''. $searchsplit7 .'\''; } if($use8 !="no"){ $sql =''.$sql .' OR pname LIKE \''. $searchspli8 .'\''; } if($use9 !="no"){ $sql =''.$sql .' OR pname LIKE \''. $searchsplit9 .'\''; } } if($county !="" & $sql ==""){ $county = $_POST['county']; $sql ="SELECT FROM pusers WHERE pcounty = '$county'"; }else if( $county !="" & $sql !=""){ $sql =''. $sql .' AND pcounty = \''. $county .'\''; } if($town !=""){ $tsearchsplit = explode(" ", $town); $tsearchsplit0 = $tsearchsplit['0']; $tsearchsplit1 = $tsearchsplit['1']; $tsearchsplit2 = $tsearchsplit['2']; $tsearchsplit3 = $tsearchsplit['3']; $tsearchsplit4 = $tsearchsplit['4']; if($tsearchsplit0 ==""){ $tuse0 ="no"; } if($tsearchsplit1 ==""){ $tuse1 ="no"; } if($tsearchsplit2 ==""){ $tuse2 ="no"; } if($searchsplit3 ==""){ $tuse3 ="no"; } if($tsearchsplit4 ==""){ $tuse4 ="no"; } if($tsearchsplit1 =="" & $tsearchsplit2 =="" & $tsearchsplit3 =="" & $tsearchsplit4 ==""){ $tuse0 ="no"; } $tsearchsplit2 = explode("-", $town); $tsearchsplit02 = $tsearchsplit2['0']; $tsearchsplit12 = $tsearchsplit2['1']; $tsearchsplit22 = $tsearchsplit2['2']; $tsearchsplit32 = $tsearchsplit2['3']; $tsearchsplit42 = $tsearchsplit2['4']; if($tsearchsplit0 ==""){ $tuse0 ="no"; } if($tsearchsplit1 ==""){ $tuse1 ="no"; } if($tsearchsplit2 ==""){ $tuse2 ="no"; } if($searchsplit3 ==""){ $tuse3 ="no"; } if($tsearchsplit4 ==""){ $tuse4 ="no"; } if($tsearchsplit02 ==""){ $tuse02 ="no"; } if($tsearchsplit12 ==""){ $tuse12 ="no"; } if($tsearchsplit22 ==""){ $tuse22 ="no"; } if($searchsplit32 ==""){ $tuse32 ="no"; } if($tsearchsplit42 ==""){ $tuse42 ="no"; } if($tsearchsplit1 =="" & $tsearchsplit2 =="" & $tsearchsplit3 =="" & $tsearchsplit4 ==""){ $tuse0 ="no"; } if($tsearchsplit12 =="" & $tsearchsplit22 =="" & $tsearchsplit32 =="" & $tsearchsplit42 ==""){ $tuse02 ="no"; } if($sql ==""){ $sql ='SELECT FROM pusers WHERE ptown LIKE \''. $town .'\''; if($tuse0 !="no"){ $sql =''.$sql .' OR ptown LIKE '. $tsearchsplit0 .''; } if($tuse1 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit1 .'\''; } if($tuse2 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit2 .'\''; } if($tuse3 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit3 .'\''; } if($tuse4 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit4 .'\''; } if($tuse02 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit02 .'\''; } if($tuse12 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit12 .'\''; } if($tuse22 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit22 .'\''; } if($tuse32 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit32 .'\''; } if($tuse42 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit42 .'\''; } }else{ $sql =''. $sql .' AND ptown LIKE \''. $town .'\''; if($tuse0 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit0 .'\''; } if($tuse1 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit1 .'\''; } if($tuse2 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit2 .'\''; } if($tuse3 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit3 .'\''; } if($tuse4 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit4 .'\''; } if($tuse02 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit02 .'\''; } if($tuse12 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit12 .'\''; } if($tuse22 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit22 .'\''; } if($tuse32 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit32 .'\''; } if($tuse42 !="no"){ $sql =''.$sql .' OR ptown LIKE \''. $tsearchsplit42 .'\''; } } } $sql =''. $sql .' LIMIT ".$limits.",$max"'; $sql ='mysql_query("'. $sql .'")'; $totalres = mysql_result(mysql_query("SELECT COUNT(id) AS tot FROM pusers"),0); $totalpages = ceil($totalres / $max); $nplimit = $totalpages; $nplimit++; while($info = mysql_fetch_array($sql2)){ echo $info['pname']; echo $info['ptown']; } echo'<br>'; if($pp =="0"){ echo(''); }else{ echo'<a href="publist.php?p='. $pp .'">'. Previous .'</a> '; } for($i = 1; $i <= $totalpages; $i++){ echo'<a href="publist.php?p='. $i .'">'. $i .'</a> '; } if($np == $nplimit){ echo(''); }else{ echo'<a href="publist.php?p='. $np .'">'. Next .'</a> '; } echo'<br>'; echo $sql; } ?> Any help will be much appriciated, Thanks, Blink359
  6. I did check the variables, the do contain what there meant to but there is no error shown its just blank were the data should be everything else on the page is fine e.g the page navigation (e.g.<< < 1 2 3 4 > >>)
  7. Hi there Im trying to add a search feature to my pagination but with some googling and searching have had no luck and have also had no luck trying myself this is what i have so far Form <form action="publist.php" method="post"> Search: <input type="text" name="search"> By: <select name="by"> <option value="name" selected="selected">Name</option> <option value="town">Town</option> <option value="county" >County</option> </select> Results Per Page: <select name="perpage"> <option value="10" selected="selected">10</option> <option value="25">25</option> <option value="50" >50</option> </select> <input type="hidden" name="hidden"> <input type="submit" value="Search"> </form> Related code: if(isset($_POST['hidden'])){ $by = $_POST['by']; $search = $_POST['search']; $sql = "SELECT * FROM table WHERE approved = 'Yes' AND '. $by .' = '. $search .' LIMIT $offset, $rowsperpage"; }else{ $sql = "SELECT * FROM table WHERE approved = 'Yes' LIMIT $offset, $rowsperpage"; } $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); while ($list = mysql_fetch_assoc($result)) { echo' <table width="700" border="1"> <tr> <td colspan="3">'. $list['name'] .'</td> </tr> <tr> <td height="24">Town: '. $list['town'] .'</td> <td>County: '. $list['county'] .'</td> <td>Postcode: '. $list['postcode'] .'</td> </tr> <tr> <td>Contact Number: '. $list['phone'] .'</td> <td>Email: '. $list['pubemail'] .'</td> <td><a href="info.php?id='. $list['ID'] .'">More Information</a></td> </tr> </table><br>'; } But when i try the search it comes out blank, Any help would be great Thanks, Blink359
  8. hmm that works but if i limit it to one row of information per page (Which is what im doing whilst i test it out as i only have 3 records for testing) I have a blank third page anyway to stop this?
  9. Hi there i wanted to know how i could rule out certain rows from being shown in the pagination in this case i want to approve all information before it's posted i tried $sql = "SELECT * FROM tablename LIMIT $offset, $rowsperpage WHERE approved = 'Yes'"; But it didnt work Any help would be great, Thanks, Blink359
  10. Ah thanks for that, found the problem Blink359
  11. Hi im trying to get pagination to work this is something im very new to and have tried a load f tutorial scripts but i keep getting: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a1581845/public_html/publist.php on line 60 here is my php code: <html> <head> <link rel="stylesheet" href="css/reset.css"> <link rel="stylesheet" href="css/style.css"> <title>E-Beer - Buying your pint has never been so easy!</title> </head> <body> <div id="head"><div id="header"> <div id="logo"></div><div id="login"> <form action="#" method="post"> <h3>Login to website:</h3> Username: <input type="text" name="name" class="1pxtotheright"><br> Password: <input type="password" name="password" class="1pxtotheright"><br> <div class="smallprint"><a href="register.php">Register Now</a> <a href="forget.php">Forgot Your Password?</a> </div> <input type="submit" value="Login"> </form> </div> </div> <div id="navbar"><a href="#">Home</a> <a href="#">Find a Pub</a> <a href="#">Register</a> <a href="#">Add your Pub</a> <a href="#">Contact Us</a> <a href="#">About Us</a></div> </div> <div id="container"> <?php include('includes/mysql.php'); $max = 1; //amount of articles per page. change to what to want $p = $_GET['p']; if(empty($p)) { $p = 1; } $limits = ($p - 1) * $max; //view the news article! if(isset($_GET['act']) && $_GET['act'] == "view") { $id = $_GET['id']; $sql = mysql_query("SELECT * FROM data WHERE id = '$id'"); while($info = mysql_fetch_array($sql)) { echo ' information'; } }else{ //view all the news articles in rows $sql = mysql_query("SELECT * FROM data LIMIT ".$limits.",$max"); //the total rows in the table $totalres = mysql_result(mysql_query("SELECT COUNT(id) AS tot FROM Pubs"),0); //the total number of pages (calculated result), math stuff... $totalpages = ceil($totalres / $max); //the table echo "<table><tr><td>Title</td><td>Author</td></tr><tr>"; while($info = mysql_fetch_array($sql)) { echo ' information } //close up the table echo " </tr></table>"; for($i = 1; $i <= $totalpages; $i++){ //this is the pagination link echo'<a href="publist.php?p='. $i .'">'. $i .'</a>'; } } ?> </div> </body> </html> If anyone could help it will be great, Thanks, Blink359
  12. Hi there i would like to send my clients a randomly generated order code by email i have had no success so far and was wondering how to do it. Any help would be great! Thanks, Blink359
  13. How do i include a php variable inside the body of my email i've tried a number of things and have had no success here is my code a the moment <? FunCtion gEtRAnDomString($lEngth = 4) { $vAliDChArACtErs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; $vAliDChArNumBEr = strlEn($vAliDChArACtErs); $rEsult = ""; For ($i = 0; $i < $lEngth; $i++) { $inDEx = mt_rAnD(0, $vAliDChArNumBEr - 1); $rEsult .= $vAliDChArACtErs[$inDEx]; } rEturn $rEsult; } FunCtion gEtRAnDomString1($lEngth = 6) { $vAliDChArACtErs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; $vAliDChArNumBEr = strlEn($vAliDChArACtErs); $rEsult = ""; For ($i = 0; $i < $lEngth; $i++) { $inDEx = mt_rAnD(0, $vAliDChArNumBEr - 1); $rEsult .= $vAliDChArACtErs[$inDEx]; } rEturn $rEsult; } FunCtion gEtRAnDomString2($lEngth = 4) { $vAliDChArACtErs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; $vAliDChArNumBEr = strlEn($vAliDChArACtErs); $rEsult = ""; For ($i = 0; $i < $lEngth; $i++) { $inDEx = mt_rAnD(0, $vAliDChArNumBEr - 1); $rEsult .= $vAliDChArACtErs[$inDEx]; } rEturn $rEsult; } FunCtion gEtRAnDomString3($lEngth = 6) { $vAliDChArACtErs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; $vAliDChArNumBEr = strlEn($vAliDChArACtErs); $rEsult = ""; For ($i = 0; $i < $lEngth; $i++) { $inDEx = mt_rAnD(0, $vAliDChArNumBEr - 1); $rEsult .= $vAliDChArACtErs[$inDEx]; } rEturn $rEsult; } FunCtion gEtRAnDomString4($lEngth = 4) { $vAliDChArACtErs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; $vAliDChArNumBEr = strlEn($vAliDChArACtErs); $rEsult = ""; For ($i = 0; $i < $lEngth; $i++) { $inDEx = mt_rAnD(0, $vAliDChArNumBEr - 1); $rEsult .= $vAliDChArACtErs[$inDEx]; } rEturn $rEsult; } $code = " gEtRAnDomString() - gEtRAnDomString1() - gEtRAnDomString2() - gEtRAnDomString3() - gEtRAnDomString4() "; //change this to your email. $to = "n**********"; $from = "na*******y_19*******co.uk"; $subject = "Code"; $message = "Your order code is: $code "; $headers .= "From: $from"; mail($to, $subject, $message, $headers); echo "Message has been sent....!"; ?> If anyone can help it will be great Thanks, Blink359
×
×
  • 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.