Jump to content

taquitosensei

Members
  • Posts

    676
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by taquitosensei

  1. It will work and is good practice but the actual problem is with the reference to an array being returned from your function.
  2. do print_r($rows); just before the foreach to make sure that it's an array and that the data looks the way it should.
  3. include supports variables. You just set the variable before you include the file $variable="BLAH"; include("echovariable.php"); echovariable.php echo $variable;
  4. in php 4.4+ if you're returning an array from a function you have to assign it to a variable before referencing it. Sorry I didn't notice the error the first time around.
  5. no...more like $filename="listmycar.php"; if(file_exists($filename)) { $mypath=realpath($filename); }
  6. use css and divs for layout then use separate files and include them for header, lefthand menu, footer, etc..
  7. if it's 5.2.4 this might apply Some users will notice that PHP applications malfunction when they upgrade to PHP 5.2.4 (included in Ubuntu 8.04 LTS) because realpath returns true for files that don't exist. This is due to the inclusion of the Hardened-PHP Project's Suhosin Patch in many distributions by default. This patch replaces PHPs realpath function with the BSD implementation, which ignores the last path component. The workaround is to use the file_exists function to verify that the file exists before using realpath to get its real path string.
  8. turn on error reporting ini_set("display_errors","1"); ERROR_REPORTING(E_ALL); blank page usually means an error that isn't being displayed.
  9. You could pass an array but you're still doing about the same amount of work. This isn't even close to tedious when you get into the more advanced stuff. If you don't want to do this, then I'd suggest getting another hobby.
  10. How are you assembling the string? You could replace hyphens in the individual parts with another character pipe |? Then assemble your string. Then split it and replace the | with -. $string1="Blink - 182"; $string2="What\'s my age"; $string1=str_replace("-", "|", $string1); etc.. etc.. $string=$string1." - ".$string2; $string_split=split(" - ",$string); foreach($string_split as $string) { $string_with_hyphen=str_replace("|", " - ", $string); echo $string_with_hyphen; }
  11. it sounds like you're using javascript which would be clientside, that's why it's using the time off your computer. I found this. http://articles.techrepublic.com.com/5100-10878_11-6016329.html sounds like what you're after.
  12. either a php library for reading excel, or if that's not an option, replace the linebreaks if it's going to be display in html you can replace with <br> $string=nl2br($string);
  13. I would adjust your table layout to make things easier in the Future instead of Device_Code, Chan1_Reference, Chan2, Chan3, etc Do Device_Code, Channel, Reference Then you can do a single query $sql="select Device_Code, Channel, Reference from devices where Reference='CW1002/W'"; I just saw the previous posters comment about normalizing, this is what he was talking about.
  14. Here's what the manual has to say It sounds like you need to verify that you have SSL support then configure it to use a personal certificate in PEM format if you don't have one in PEM format you need to convert it. HTTPS Secure HTTP requires SSL libraries to be installed and used when curl is built. If that is done, curl is capable of retrieving and posting documents using the HTTPS protocol. Example: curl https://www.secure-site.com Curl is also capable of using your personal certificates to get/post files from sites that require valid certificates. The only drawback is that the certificate needs to be in PEM-format. PEM is a standard and open format to store certificates with, but it is not used by the most commonly used browsers (Netscape and MSIE both use the so called PKCS#12 format). If you want curl to use the certificates you use with your (favourite) browser, you may need to download/compile a converter that can convert your browser's formatted certificates to PEM formatted ones. This kind of converter is included in recent versions of OpenSSL, and for older versions Dr Stephen N. Henson has written a patch for SSLeay that adds this functionality. You can get his patch (that requires an SSLeay installation) from his site at: http://www.drh-consultancy.demon.co.uk/ Example on how to automatically retrieve a document using a certificate with a personal password: curl -E /path/to/cert.pem:password https://secure.site.com/ If you neglect to specify the password on the command line, you will be prompted for the correct password before any data can be received. Many older SSL-servers have problems with SSLv3 or TLS, that newer versions of OpenSSL etc is using, therefore it is sometimes useful to specify what SSL-version curl should use. Use -3, -2 or -1 to specify that exact SSL version to use (for SSLv3, SSLv2 or TLSv1 respectively): curl -2 https://secure.site.com/ Otherwise, curl will first attempt to use v3 and then v2. To use OpenSSL to convert your favourite browser's certificate into a PEM formatted one that curl can use, do something like this (assuming netscape, but IE is likely to work similarly): You start with hitting the 'security' menu button in netscape. Select 'certificates->yours' and then pick a certificate in the list Press the 'export' button enter your PIN code for the certs select a proper place to save it Run the 'openssl' application to convert the certificate. If you cd to the openssl installation, you can do it like: #. /apps/openssl pkcs12 -in [file you saved] -clcerts -out [PEMfile]
  15. I would put the number of rows before the loop $shows = mysql_query("SELECT * FROM tblConcert WHERE fkBandID = '$pk' AND fldConcertDate >= CURDATE() ORDER BY fldConcertDate", $db); $numRows = mysql_num_rows($shows); if($numRows == 0){ echo "<p>No upcoming shows for $show[fldBand]. <a href='#'>Know of one?</a></p>"; } else { while($show = mysql_fetch_array($shows, MYSQL_ASSOC)){ $date = date("F j, Y",strtotime($show[fldConcertDate])); }
  16. if it's a date or datetime field in MySQL it's Y-m-d H:i:s format it before you insert $date_field=date("Y-m-d", strtotime($date)); $sql="insert into yourtable(datefield) values('$date_field')";
  17. I would use a pre-built class for sending mail, makes it much easier, you can configure an SMTP server with authentication. I use pear's http://pear.php.net/package/Mail
  18. Try this $sql = "SELECT clients.company, clients.client_id, contacts.client_id, contacts.name, contacts.contact_id, contact_coms.contact_id, contact_coms.com_content ". "FROM clients JOIN contacts on clients.client_id=contacts.client_id LEFT JOIN contact_coms on contacts.contact_id=contact_coms.contact_id where clients.ctype=2"; the easiest way to think of a left join is, you're selecting all records on the table listed to the left of "LEFT JOIN" and the table listed to the right of LEFT JOIN will show an empty record if there isn't a match.
  19. If you're going to get more than 1 result. If Sect1_6 isn't a unique index. Then you need to loop through the mysqlresults. But that doesn't quite work with the header redirection. list($name, $domain) = explode("@", $email); $error = mysql_query("SELECT `Sect1_6`,`Sect1_7d`,`CompanyID` FROM tblDirectory2 WHERE `Sect1_6`='$email'") or die(mysql_error()); $errorID = mysql_fetch_array($error); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $emailcheck=$row['Sect1_6']; list($name, $domaincheck) = explode("@", $emailcheck); $postcode = strtoupper($_POST["Sect1_7d"]); $postcodecheck = strtoupper($errorID["Sect1_7d"]); if ($domaincheck == $domain || $postcodecheck == $postcode) { header("Location: /new_directory/completed.php?ID=".$errorID["CompanyID"].""); exit(); } [/code] I would also put the code exploding $email outside of the loop so that you're not exploding it every instance through the loop. If it's going to be a single result then this would probably get you close $email = $_POST["Sect1_6"]; $error = mysql_query("SELECT `Sect1_6`,`Sect1_7d`,`CompanyID` FROM tblDirectory2 WHERE `Sect1_6`='$email'") or die(mysql_error()); $errorID = mysql_fetch_array($error,MYSQL_NUM); // This gives you a numeric indexed array $emailcheck = $errorID[0]["Sect1_6"]; // notice the 0 list($name, $domain) = explode("@", $email); list($name, $domaincheck) = explode("@", $emailcheck); $postcode = strtoupper($_POST["Sect1_7d"]); $postcodecheck = strtoupper($errorID[0]["Sect1_7d"]); // Notice the 0 if ($domaincheck == $domain || $postcodecheck == $postcode) { header("Location: /new_directory/completed.php?ID=".$errorID["CompanyID"].""); exit(); }
  20. That's the point of the function I posted it's recursive and checks to see if the folder exists or not.
  21. They're probably tabs try str_replace("\t","", $s);
  22. You're missing a step check out http://www.tizag.com/mysqlTutorial/mysqlquery.php This should help
×
×
  • 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.