Jump to content
Larry Ullman's Book Forums

MrLeche

Members
  • Content Count

    11
  • Joined

  • Last visited

  • Days Won

    1

MrLeche last won the day on August 2 2011

MrLeche had the most liked content!

Community Reputation

1 Neutral

About MrLeche

  • Rank
    Newbie
  1. Hi Sir, Thank you for your reply. I will study about JOINS and deeper MySQL functions that I always shy away from, I had an attitude before that I think I already learned the "only" things I need to know to make it work. Which results to inefficiencies. Working with JOINS and AS will be very difficult for me but I sure need to give it a try. Thank you sir.
  2. Hi All. I am having a problem displaying results of my page, maybe I think because I've poorly written the code. I have these tables: 1. customers (cust_id, name, address, TIN, price, timestamp) 2. purchases(po_id, cust_id, delivery_address, delivered, receivedby, paid, encoderid, agentid, timestamp) 3. po_content(table_id, po_id, prod_id, ordered, delivered, srp, timestamp) when generating a query, now that the database have a lot of content inside It's taking a while to display the result on the server and it shows "page cannot be displayed" while querying it from another computer via LAN. here's what I wrote: $rownum = 1; $a = "SELECT * FROM purchases ORDER BY timestamp ASC LIMIT $start $display"; $b = mysql_query($a); while ($c = mysql_fetch_array($) { $d = "SELECT * FROM po_content WHERE po_id='{$c['po_id']}'"; $e = mysql_query($d); while ($f = mysql_fetch_array($e)) { $amount = $amount + ($f['srp'] * $f['delivered']); } $total = $total + $amount; $g = "SELECT * FROM customers WHERE cust_id='{$c['cust_id']}'"; $h = mysql_query($g); $i = mysql_fetch_array($h); //bg stuff so it would be seen nicely if ($rownum % 2 == 0 ) { $bgcolor = '"bgcolor=#f3f3f3"'; } else { $bgcolor = '"bgcolor=#ffffff"'; } print ' <table width="100%" border="0" cellspacing="0" cellpadding="0" ' . $bgcolor . '> <tr> <td>' . $rownum . '. </td> <td>' . $c['po_id'] . '</td> <td>' . $i['name'] . '</td> <td>' . date('m d, Y', $c['timestamp']) . '</td> <td>$ ' . number_format($amount, 2) . '</td> <td>' . $agent . '</td> <td>' . $encoder . '</td> </tr> </table> '; $amount = 0; //reset the amount before looping again. } print '<td><div align="right">' . $number_format($total, 2) . '</div></td>'; There. $agent and $encoder has been called from an if(in_array) but still I think it adds up to the whole process. Now that the structure of the database has been like that. Would there be a damage control type thing that would optimize my queries? Many many thanks in advance!
  3. I didn't know about that, I googled and found out that SQL Injection Attack is scary but they only have ASP IIS examples. Do you have a book that discuss this? Thanks!
  4. @HartleySan Thanks for that info I would definitely try that out. Now that I have almost completed encoding content into MySQL, I need do that using the html form through "UPDATE". Thank you for that big help @Paul Swanson Hi, Now I would like to learn about htmlentities(). I have also frequent encounters with tiny_MCE, I had that when customizing joomla. Having said that, I wanted to learn and progress as I have been trained by Sir Larry Ullman's book. I have observe the way he teaches through his books to program everything from scratch. having tiny_MCE over my forms would be very fancy and handy, but I won't learn how it would supress the errors I encounter, at least not for me. No offense to tiny_MCE I think it's really great. uhm. well, what happened to me is I always do a project that sometimes inserting the textarea content with qoutes and carriage works. Then comes a project that it doesn't. Sometimes i get away with it but this time I really wanted to know the absolute uh... discipline? For example, this may be a bit Off Topic. But I always write 'SELECT * FROM database WHERE user_id = ' . $_POST['uid']; There. that syntax always work for me. But if i am string specific it doesn't. So I write it with this example: "SELECT * FROM database WHERE name ='" . $_POST['name'] . "'"; There. that one worked for me. Now if I have to explain to a person when do I get to use the double quote and single on queries interchangeably, I actually don't know how to answer back. all I know is that.. it works. heheheh When I get to try out a working htmlentities() example. I'd be very happy. always read that on PHP.net Manual but the example there isn't too friendly for me. Thanks!
  5. Hi, I would like to ask your experience when submitting plain html forms particularly <textarea> This is mainly used for description and content. And as such long words and text, it is inevitable to advise end-user to escape every quote and double quote and either type \n or <br /> whenever they needed it to output a new line or carriage return. I'm really not sure how to handle this. I do not know if I need to use a function before inserting to the database, and/or add another function after retrieving. I've google for nl2br(), tried printing it as ' . nl2br($row['content']) . ' concantenated to an HTML tag, but unfortunately It didn't work for me. Anyone? Thanks!
  6. Nah. for me, I never came to de-mystify which falls to legit and junk. I had my personal email account for over eight years now, Those were the days when spams are still more popular as meatloaf in a can as opposed to junk email right now. But they still fall into junk/spam most of the time. Particulary when it is your first time sending out to a new email address that you haven't send out before.
  7. Hi, I'm an XAMPP user. running on w7 x64 as localhost testing server. I'm gonna have to ask you questions regarding your question. 1. You actually sent out an email as mentioned using php mail() function. You followed it up by asking I wish I knew how to on xampp. Well. Where did you actually used the function that was sent out to your gmail spam? I was pressuming a hosted testing server. In any case, the mail() function would work on your XAMPP locally. First you have to enable the "mercury" mail server on your XAMPP control panel (even if is just started ordinary and not a service). with a running mercury server all you need to do is write a test email.php script and you'll progress from there. <?php // simple email test ini_set("SMTP", "stmp.myisp.com"); // setting up your localhost to send via you ISP's SMTP settings ini_set("sendmail_from", "myaccount@myisp.com"); // this is necessary if your ISP requires username upon SMTP ini_set("smtp_port", "25"); // well the default port is 25 but if your ISP's SMTP port isn't 25, you can actually change it here. // then the simple mail() function test. $to = 'mygmailmail@gmail.com'; // receipient $from = 'From: myxampp@mypc.com'; // sender $subject = 'Hello World!'; // Subject line $message = 'This is an email test.'; // your message. // Again, this is just probably be the simplest form of testing out your mail() function. mail($to, $subject, $message, $from); echo 'If I haven\'t prompted an error report, I\'d better check my inbox or spam.'; ?> 2. 2nd Q., what type of email are you trying to send out? The example above will just be plain text. you can use the mail() function for delivering emails in text formats and HMTL as well. And even with attachments. Again you can progress as soon as you are able to use your xampp locally if that is what you want. <?php // simple HTML email test ini_set("SMTP", "stmp.myisp.com"); // setting up your localhost to send via you ISP's SMTP settings ini_set("sendmail_from", "myaccount@myisp.com"); // this is necessary if your ISP requires username upon SMTP ini_set("smtp_port", "25"); // well the default port is 25 but if your ISP's SMTP port isn't 25, you can actually change it here. // then the simple HTML mail() function test. $to = 'mygmailmail@gmail.com'; // receipient $from = 'From: myxampp@mypc.com'; // sender $subject = 'Hello World! (HTML Version)'; // Subject line $message = ' <html> <head> </head> <body> <p>This is an HTML formatted email.</p> </body> </html>'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers . = 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers . = 'Cc: carbonme@gmai.com' . "\r\n"; // if you want to have a cc. $headers . = 'Bcc: blindme@gmail.com' . "\r\n"; // if you wanted to have a blind carbon copy $headers . = 'From: HartleySan<myemailadd@mypc.com>' . "\r\n"; mail ($to, $subject, $message, $headers); echo 'If I haven\'t prompted an error report, I\'d better check my inbox or spam.'; ?>
  8. Thank you I will try to study that one. And hope it works for cross-browsers and platforms.
  9. Hello, It's been less than an hour now thinking of where to post this topic. To start of with, I only know how to code php. I use a wyswyg to get my html coded (and others). So here's the thing: As Adobe turn greedy now, Adobe Flash doesn't have support for most postable devices that people use as their website browsing material these days. As a website developere's challenge. I wanted to achieve on how to I get value passed from client-side to server side automatically. In specifics to this question, I need to ask you guys if you know a way where the server would know the client's OS and Browser. I saw from another website that it has a widget (of some sort) saying your OS is: and Your browser is:. I tested it using different browsers, and different OS, finally tested mobile devices and play gadgets like nintendo browsers etc. The results using PC is perfect, Mobile Devices have a passing rate, playing devices are poor. Despite that, I wanted to somehow use if($YourOS is 'IOS4') { header("Location: noflash.php" } . This way I can even designate where the viewer accompanied by their browsing devices be thrown at. Note that I only know PHP no javascript knowledge of some sort. Thanks for hearing me out. Even if my question is a silly one because man it really feels like its too complicated for me.
  10. Sheez, that easy I was googling and resulted to JOINS, LEFT JOINS, ON AS... Thanks, I'll run a quickie.
  11. Hi, I would like to know how you would select from multiple tables: tableA colx, coly, cola, colb, colc and tableB col1, col2, cola, colb, colc the tables only differ from the first 2 columns of each of them (tables) but I would like to have it SELECT * FROM "both of them" actually the reason for that is I wanted to lay all out in a while() loop, and at the same time paginate it. while tableA consist of older records, time-wise, it will be the first to be "echo-ed", I had problems paginating it if I do not join the query into a single query as opposed to querying tableA, then echo, then query tableB then echo. thanks!
×
×
  • Create New...