Jump to content

ultraloveninja

Members
  • Posts

    85
  • Joined

  • Last visited

Everything posted by ultraloveninja

  1. I am trying to figure out how to add the result of a single row from a mysql select but I just can't seem to wrap my head around it. Here's what I have: $sql = "select ct_qty from tbl_cart"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { $qty = $row['ct_qty']; } echo "QTY: $qty <br /><br />"; which will return the result like this: QTY: 1 QTY: 3 But I just can't remember how to add those two numbers together.
  2. I am using ZenCart with the UPS XML shipping Module and it's having an issue connecting to the UPS server and it's kicking back a cURL error: Error from cURL: Error [77]: error setting certificate verify locations: CAfile: /usr/local/share/curl/curl-ca-bundle.crt CApath: none I am not too sure what this means, but I have a sneaking suspicion that it may have something to do with not having a security certificate installed on the server. But any help would be greatly appreciated to shed some light on this error. Thank!
  3. yeah, that's what i thought at first, but then it will look like it's true regardless and pull the next query and adds it in there when it's not supposed to. meh. i am not that well versed in PHP to understand most what needs to be done for the most part. i am just going to try something else and see if that works.
  4. Yeah...I am offically confused now. I am not sure where the variables need to go.
  5. Cool. Thanks for clearing that up. Just need to figure out where to put the array: while ($row = mysql_fetch_array($result)){ $pick = $row['pick']; $event = $row['event']; $starttime = $row['starttime']; $endtime = $row['expiretime']; $enddate = $row['expiredate']; $etime = ( date("g:i a", strtotime($endtime)) ); $stime = ( date("g:i a", strtotime($starttime)) ); $edate = ( date("m/d/Y", strtotime($enddate)) );
  6. I am trying to get something to display from a mysql query using a case statement, but I am having trouble trying to get it to work right. basically, i am trying to get it to display one thing if there is a result that comes back true. but if it doesn't i want it to use a different mysql query and display something else and i am just confused on how to get it to work. here is my code: <?php include 'dbconn.php'; $sql = "select * from picks where expiredate = curdate() and curtime() < expiretime and starttime < curtime();"; $result = mysql_query($sql,$conn); $anymatches=mysql_num_rows($result); if ($anymatches == 0) { $sql = "select * from picks where expiredate > curdate() order by expiredate asc limit 1;"; $result = mysql_query($sql,$conn); echo <<<END <div align="center">There is no pick available at this time $edate</div> END; } while ($row = mysql_fetch_array($result)){ $pick = $row['pick']; $event = $row['event']; $starttime = $row['starttime']; $endtime = $row['expiretime']; $enddate = $row['expiredate']; $etime = ( date("g:i a", strtotime($endtime)) ); $stime = ( date("g:i a", strtotime($starttime)) ); $edate = ( date("m/d/Y", strtotime($enddate)) ); echo <<<END <div align="center">This current pick is available:<br /> $event<br /> END; } ?> more or less this is the part that i am having trouble with: if ($anymatches == 0) { $sql = "select * from picks where expiredate > curdate() order by expiredate asc limit 1;"; $result = mysql_query($sql,$conn); echo <<<END <div align="center">There is no pick available at this time $edate</div> END; } I am not sure what needs to happen there, I guess. I thought that I had this working, but I guess not.
  7. Like this: <?php $my_file = "index.php"; $end_file = "test_index.html"; $fh = fopen($my_file,'r') or die("can't open file"); fread($fh, echo $end_file); echo "File succesfully written"; ?> Sorry, still pretty green to syntax formatting and what not.
  8. Ok, so I've been trying to find what I need and I have not really been able to come across anything that looks like it does the trick. I am looking to write out and HTML file based on what gets parsed out by the PHP page. For example, the PHP page redenders out a table of information, and if I go to view source, it will show all of the HTML that has been written out by the PHP page. My question is how do I take the HTML that is written out by the PHP page and create a HTML file? I've seen some things with fopen and fwrite, but it's not writing out anything: <?php $my_file = "index.php"; $end_file = "test_index.html"; $fh = fopen($my_file,'r') or die("can't open file"); fwrite($fh, $end_file); echo "File succesfully written"; ?> Am I on the right track???
  9. Ok. I see what you are saying. You wouldn't happen to have any resources on moving files around then? I am kinda new to the whole scheme of PHP. Sorry.
  10. Hello- I was wondering if anyone had any resources, guides, etc. about how to use PHP to upload files to a FTP account. The FTP account is already created on a server and i just want to use a web based form to upload files to that FTP account. If any one has any information about this, it will be greatly appreciated. Thanks!
×
×
  • 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.