Jump to content

Dicko_md

Members
  • Posts

    44
  • Joined

  • Last visited

Everything posted by Dicko_md

  1. Hi Sorry I wasnt trying to get the code for free without trying. I was genuinely not sure how to incorporate this into your code you shared. I have probably gone about it the wrong or should I say long way round but it works below after playing with my code. $result = mysql_query("Select DISTINCT phone.model, phone.model_no, phone.icon, phone.year, phone.capacity From phonerepairs INNER JOIN phone ON phonerepairs.phone=phone.phone WHERE phone.model_no='".$_POST['model']."'"); $result2 = mysql_query("Select * From phonerepairs INNER JOIN phone ON phonerepairs.phone=phone.phone WHERE phone.model_no='".$_POST['model']."'"); while($row = mysql_fetch_array($result)) { echo '<tr>'; echo '<td width="70" align="center"><img src="'.$row['icon'].'" width="66"></td>'; echo '<td width="100" align="center">'.$row['model_no'].'</td>'; echo '<td width="130" align="center">'.$row['model'].'</td>'; echo '<td width="50" align="center">'.$row['year'].'</td>'; echo '<td width="150" align="center">'.$row['capacity'].'</td>'; echo '</tr>'; } echo '</table><br></p>'; while($row = mysql_fetch_array($result2)) { echo '<p>'; echo '<div id="pageheading"><h3><div id="title">Repairs we carry out for '.$row['model'].'</div></h3></div>'; echo '<table width="99%" cellpadding="5" cellspacing="0" border="1">'; echo '</p>'; echo '<p>'; echo '<tr>'; echo '<td align="center"><strong>Image</strong></td>'; echo '<td align="center"><strong>Fault</strong></td>'; echo '<td align="center"><strong>Repair</strong></td>'; echo '<td align="center"><strong>Cost</strong></td>'; echo '</tr>'; echo '<tr>'; echo '<td width="70" align="center"><img src="'.$row['icon'].'" width="66"></td>'; echo '<td width="100" align="center">'.$row['fault'].'</td>'; echo '<td width="130" align="center">'.$row['description'].'</td>'; echo '<td width="50" align="center">&pound'.$row['cost'].'</td>'; echo '</tr>'; echo '</table><br>'; } mysql_close($con); ?> </p> The only nicety thing I would like if possible is to alternate the table heading on each fix available if its a quick fix. Thanks Martyn
  2. Any one able help to show me how to use the above code with my code ? Thanks Martyn
  3. Hi Thanks for your reply. Would I be best keeping the 2 tables separate and use your code above ? I have one column in each table that is the same ie phone so this could be the stored variable. How would I get my code into your suggestion to output the available repairs for a particular phone. ? Thanks again Martyn
  4. Hi I have 2 tables that I am searching infor for. One holds the phone info and the other the repairs that are available. I have the code below and it displays on the webpage in a table for the phone information and then another table the repairs but they seem to be separate tables and headers. inbetween them is the phone and the details which separates the repairs but its not in a table. Hopefully the code below will explain better. What I would like it the phone details in one table and then a table full of all the repairs (I am not bothered about a new heading for each repair). $result = mysql_query("SELECT * FROM phone, phonerepairs WHERE phone.model_no='".$_POST['model']."' AND phone.phone = phonerepairs.phone"); while($row = mysql_fetch_array($result)) { echo '<td width="70" align="center"><img src="'.$row['icon'].'" width="66"></td>'; echo '<td width="100" align="center">'.$row['model_no'].'</td>'; echo '<td width="130" align="center">'.$row['model'].'</td>'; echo '<td width="50" align="center">'.$row['year'].'</td>'; echo '<td width="150" align="center">'.$row['capacity'].'</td>'; echo '</tr>'; echo '</table><br>'; echo '</p>'; echo '<p>'; echo '<div id="pageheading"><h3><div id="title">Repairs we carry out for '.$row['model'].'</div></h3></div>'; echo '<table width="99%" cellpadding="5" cellspacing="0" border="1">'; echo '</p>'; echo '<p>'; echo '<tr>'; echo '<td align="center"><strong>Image</strong></td>'; echo '<td align="center"><strong>Fault</strong></td>'; echo '<td align="center"><strong>Repair</strong></td>'; echo '<td align="center"><strong>Cost</strong></td>'; echo '</tr>'; echo '<tr>'; echo '<td width="70" align="center"><img src="'.$row['icon'].'" width="66"></td>'; echo '<td width="100" align="center">'.$row['fault'].'</td>'; echo '<td width="130" align="center">'.$row['description'].'</td>'; echo '<td width="50" align="center">&pound'.$row['cost'].'</td>'; echo '</tr>'; echo '</table><br>'; Thanks in advance Martyn
  5. Thank you all for your help. Im definately learning slowly. Martyn
  6. <a class="dark" href='index_1.php?s=remindpass'>FORGOT PASSWORD</a> This is the offending line. I removed it and it worked fine. Does anything stand out ?
  7. Hi That didn't work. I got the same. Thanks again
  8. Nothing is been output. just says below and no arrows next to them with any code in <head></head> <body></body> Thanks
  9. Thanks reading now but if anyone knows why its doing it. please tell. thanks again
  10. I have changed he " to ' onfocus but that hasn't changed anything. I get nothing output. The webpage is just white. Not sure how to debug Thanks
  11. This is what I tried. function FormLogin() { $html = " <form method='post' name='forml' action='index_1.php?s=login'> <input type='hidden' name='dologin' value='1'> <input type='text' name='email' value='email' onfocus="if (this.value=='email') this.value='';"/> <input type='password' name='password' value='password' onfocus="if (this.value=='password') this.value='';"/> <input type='submit' name='login' id='submit' value='SIGN IN' class='submit'> <a class="dark" href='index_1.php?s=remindpass'>FORGOT PASSWORD</a> <script language='javascript'> document.forml.email.focus(); </script> </form> "; return $html; } Ive tried with and without the script. Im guessing it is something with the " on the onfocus as its closing the line. Ive also tried \" also Thanks Martyn
  12. <form method='post' name='forml' action='index_1.php?s=login'> <input type='hidden' name='dologin' value='1'> <input type='text' name='email' value='email' onfocus="if (this.value=='email') this.value='';"/> <input type='password' name='password' value='password' onfocus="if (this.value=='password') this.value='';"/> <input type='submit' name='login' id='submit' value='SIGN IN' class='submit'> <a class="dark" href='index_1.php?s=remindpass'>FORGOT PASSWORD</a> </form> Ive just tried this in the normal php file and it works fine. When I tried taking off the " off the onfocus to ' it left the EMAIL and ****** in the boxes.
  13. Hi Im still learning and no I haven't. How would I do that ? I know it works in a normal php file but I was wondering if its the " around the onfocus as the other items can have ' instead Thanks
  14. This is my current code but if I try and swap the code function FormLogin() { $html = " <div id='login'> <form method='post' name='forml' action='index_1.php?s=login'> <input type='hidden' name='dologin' value='1'> <table cellpadding='2'> <tr><td class='formlabel'>Email:</td><td><input type='text' name='email' value='EMAIL' style='width: 100%'></td></tr> <tr><td class='formlabel'>Password:</td><td><input type='password' name='password' style='width: 100%'></td></tr> <tr><td> </td><td><input type='submit' class='submit' name='login' value='SIGN IN' id='submit' style='width: 100%'></td></tr> <tr><td> </td><td><p align='center'><a class='dark' href='index.php?s=remindpass'>FORGOT PASSWORD</a></p></td></tr> </table> <br /></div> <script language='javascript'> document.forml.email.focus(); </script> </form> "; return $html; } with the below it doesn't work. I have tried swapping the " with ' and that didn't work. Have I missed something as the below code works in a normal php file . <form method='post' name='forml' action='index_1.php?s=login'> <input type='hidden' name='dologin' value='1'> <input type="text" name="email" value="email" onfocus="if (this.value=='email') this.value='';"/> <input type="password" name="password" value="password" onfocus="if (this.value=='password') this.value='';"/> <input type="submit" name="login" id="submit" value="SIGN IN" class="submit"> <a class="dark" href='index_1.php?s=remindpass'>FORGOT PASSWORD</a> </form> Thanks in advance Martyn
  15. Sorry my fault. Oversight. I had 2 emails as it was an if statement and I hadn't updates the $timestamp in the other email script. Sorry and thanks
  16. Hi yes I have run a echo and it says the time the actual reminder was set for. $message .= "<tr style='background: #eee;'><td><strong>Event Date:</strong> </td><td>" .$timestamp. "</td></tr>"; Its this line that's not playing ball. Its just empty in the email but all the other info is there. Thanks Martyn
  17. function SendReminder($info, $isadvanced) { $sitename = GetConfig('sitename'); $siteurl = GetConfig('siteurl'); $comment = stripslashes($info['shcomment']); $stub = db_select('ar_members', 'id', "id=$info[userid]"); if (!mysql_num_rows($stub)) { db_delete('ar_notify', "id=$info[id]"); return; } $tzoffset = GetUserOffset($info['userid']); $formdate = time()-$tzoffset; $formdate = date("l jS F Y H:i", $formdate); $timestamp = date("l jS F Y H:i", $info['date_field']); $timecreated = date("l jS F Y H:i:s", $info['timecreated']-$tzoffset); This gets sent in an email but its blank $message .= "<tr style='background: #eee;'><td><strong>Event Date:</strong> </td><td>" .$timestamp. "</td></tr>"; Ive tried adding the $timestamp line in but this still doesn't work. If I have $formdata in the $message email it shows the time the email was created not the time of the event. The date_field is the column in the database where I am getting the data from. Its a unix style date. Thanks in advance Martyn
  18. Ive got the script to work but I cant get the $formdate to convert the timestamp to the actual time. Ive tried $dateTimeEnd = ($info['date_field']); $datestampconvert = strtotime($dateTimeEnd); but when I try to put this in an email its blank. Any other way to convert timestamp from database and show it on a webpage/email ? Thanks martyn
  19. does this look right ? $data = db_select('ar_notify', 'email_sent="0"'); while ($info = mysql_fetch_assoc($data)) SendReminder($info, false); If I change db_select to db_update and email_sent="1" it updates email_sent to 1 when I run the script but the above does not select any email_sent even though they have a Zero in them ? Thanks Martyn
  20. First Question. adding another column to the table and I chose ENUM. it says that it must have a figure in it of some kind. I will be choosing Yes or No as the column will be called email_sent. What I would like to know is. Will old data and new be OK as I don't fill this column in on any other page? The column will only be filled in/updated will be a separate cron job that updates the column when the event is created ? Thanks Martyn
  21. I hear you. Ill give it a go but will probably be back for something or another. Thanks again Martyn
  22. cheers. I am guessing that a simple column called e-sent and either yes or empty will suffice. If that is the case what would the code be ? Thanks Martyn
  23. Thanks I will try that tomorrow and let you know how it goes
  24. Hi I have the script below that runs on a cron job every 1 minute. I have 2 scripts that sends email reminders. The other script sends a reminder email and a email on the time requested. This script I would like the email to be sent as soon as the event has been logged. Only problem is that it keeps sending the email every minute till the event. Is there anyway to only send one email to the user from this script. If a marker needs to be put down, then can you explain how to as im guessing this will need to be done in the MySQL database. ? I have played round with the $data line and created the $event_logtime to see if that would do it..... but it didn't. <?php include('elements.php'); $curtime = time(); echo "Cron Started\nServer Time: ".date("F j, Y, g:i a", $curtime)."\n"; $event_logtime = ($curtime - 60); $data = db_select('ar_notify', '*', $event_logtime); while ($info = mysql_fetch_assoc($data)) SendReminder($info, false); echo 'Cron Completed!'; function SendReminder($info, $isadvanced) { $sitename = GetConfig('sitename'); $siteurl = GetConfig('siteurl'); $comment = stripslashes($info['shcomment']); $stub = db_select('ar_members', 'id', "id=$info[userid]"); if (!mysql_num_rows($stub)) { db_delete('ar_notify', "id=$info[id]"); return; } $tzoffset = GetUserOffset($info['userid']); $formdate = time()-$tzoffset; $formdate = date("l jS F Y H:i", $formdate); $timecreated = date("l jS F Y H:i:s", $info['timecreated']-$tzoffset); if ($info['recurring']) $addcomment = "\n\nYou have set up a CONTINUOUSLY recurring AutoReminder event.\n". " You can disable this ". "or find your password by going to $siteurl."; else $addcomment = "\n\nYou have set up a ONE-TIME non-recurring AutoReminder event and you will next be reminded on the event date.\n". "It was created on $timecreated by a web-browser at $sitename Internet site .". "You can disable this ". "or find your password by going to $siteurl."; if ($isadvanced) { switch ($info['notify_val']) { case 1: $info['notify_val'] = 'minute(s)'; break; case 2: $info['notify_val'] = 'hour(s)'; break; case 3: $info['notify_val'] = 'day(s)'; break; case 4: $info['notify_val'] = 'month(s)'; break; case 5: $info['notify_val'] = 'year(s)'; break; } //Reminder Advance Email $commenttype .= $addcomment."\n"; $smallcomment .= "\n".GetConfig('defaultmsg'); $commentmessage .= $info['shcomment']; $commentreminder .= "Initial Reminder"; $to = $info['email']; $subject = "Reminder for " .$info[subject]; $headers = "From: XXXXXXXX.com <reminder@XXXXXXXX.com>\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $message .= '<html><Head></Head><body>'; $message .= '<img src="http://www.XXXXXXXX.com/images/XXXXX_logo_paypal.png" alt="Logo" />'; $message .= '<table border=1px rules="all" style="border-color: #666;" cellpadding="10">'; $message .= "<tr style='background: #eee;'><td><strong>Event Date:</strong> </td><td>" .$formdate. "</td></tr>"; $message .= "<tr><td><strong>Event Message:</strong></td><td>" .$commentmessage. "</td></tr>"; $message .= "<tr><td><strong>Type of Message:</strong></td><td style='background: #66CD00;'>" .$commentreminder. "</div></td></tr>"; $message .= "<tr><td colspan='2' style='font-size: xx-small'>" .$commenttype. "</td></tr>"; $message .= "<tr><td colspan='2' style='font-size: xx-small'>" .$smallcomment. "</td></tr>"; $message .= "</table>"; $message .= "</body></html>"; mail($to, $subject, $message, $headers); } else { //Reminder Email $commenttype .= $addcomment."\n"; $smallcomment .= "\n".GetConfig('defaultmsg'); $commentmessage .= $info['shcomment']; $commentreminder .= "One Time Reminder"; $to = $info['email']; $subject = "Reminder for " .$info[subject]; $headers = "From: XXXXXX.com <reminder@XXXXXXXXX.com>\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $message .= '<html><Head></Head><body>'; $message .= '<img src="http://www.XXXXXXXXX.com/images/XXXXX_logo_paypal.png" alt="Logo" />'; $message .= '<table border=1px rules="all" style="border-color: #666;" cellpadding="10">'; $message .= "<tr style='background: #eee;'><td><strong>Event Date:</strong> </td><td>" .$formdate. "</td></tr>"; $message .= "<tr><td><strong>Event Message:</strong> </td><td>" .$commentmessage. "</td></tr>"; $message .= "<tr><td><strong>Type of Message:</strong></td><td style='background: #66CD00;'>" .$commentreminder. "</div></td></tr>"; $message .= "<tr><td colspan='2' style='font-size: xx-small'>" .$commenttype. "</td></tr>"; $message .= "<tr><td colspan='2' style='font-size: xx-small'>" .$smallcomment. "</td></tr>"; $message .= "</table>"; $message .= "</body></html>"; mail($to, $subject, $message, $headers); } echo "Sent mail to: $info[email]<br />";} ?> Any more info, then just ask and I will try and provide
×
×
  • 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.