taquitosensei
Members-
Posts
676 -
Joined
-
Last visited
-
Days Won
2
Everything posted by taquitosensei
-
try this $val_exp=explode(":\/", $client); $val=$val_exp[1]; should give you everything after the D:/ it will also accommodate other drive letters to without any changes.
-
How to use the if statement with data from a database?
taquitosensei replied to lavarat's topic in PHP Coding Help
I would set is_finalized to boolean in your database and then re-arrange your if statements a little. That way you can do this $line = 1; while ($row = mysql_fetch_assoc($result)) { if ($row["is_finalized"]) { $color_code=""; if($line%2==1) { $color_code="bgcolor='".$this->color_line."'"; } echo " <tr ".$color_code. ">\n"; echo " <tr>\n"; echo " <td>" . $row["submission_id"] . "</td>\n"; echo " <td>" . $row["col_1"] . "</td>\n"; echo " <td>" . $row["col_2"] . "</td>\n"; echo " <td>" . $row["col_3"] . "</td>\n"; echo " <td>" . $row["col_4"] . "</td>\n"; echo " <td>" . $row["col_5"] . "</td>\n"; echo " <td>" . $row["col_7"] . "</td>\n"; echo " </tr>\n"; $line++; } } -
save as a csv then use load data infile http://dev.mysql.com/doc/refman/5.1/en/load-data.html
-
thousands of entries is nothin' I had a table with over 4 million entries with not much of a performance hit. I knew but nobody using my app did.
-
$array=array( array("whatever"=>"whatever"), array("somethingelse"=>"somethingelse") ); you can keep nesting like that almost infinitely. another way $array=array(); $array['subarray']['key1']="hmmm"; $array['subarray']['key2']="whatever";
-
[SOLVED] how to url decode this youtube code ?
taquitosensei replied to jjk2's topic in PHP Coding Help
I think you html_entity_decode(); -
[SOLVED] PHP MySQL - explode, while, foreach issue
taquitosensei replied to moonlightinred's topic in PHP Coding Help
I don't see an obvious problem. Try this $query_checkboxlist = "SELECT ID, TYPE, VALUE FROM table1 WHERE TYPE='typeofbox'"; $result_checkboxlist = mysql_query($query_checkboxlist); $query = "SELECT ID, CHECKBOXES FROM table2 WHERE ID=4"; $result = mysql_query($query); echo "<ul>\n"; while($row_checkboxlist = mysql_fetch_array($result_checkboxlist)){ while($row = mysql_fetch_assoc($result)) { $markedboxes = explode(",",$row['CHECKBOXES']); foreach($markedboxes as $key=>$value) { echo '<li><input type="checkbox" name="involvement[]" value="'.$row['ID'].'" '; $checked=""; if($row["ID"] == $value) { $checked="checked='yes'"; } echo $checked."/>".$row['VALUE']."</li>\n"; } } } echo "</ul>\n"; -
It sounds like apache is not setup to parse php. create testphp.html <?php phpinfo(); ?> see if it will parse that if so then check your httpd configuration for this line AddModule mod_php5.c make sure it's not commented out.
-
Links to images do not display from a PHP variable correctly
taquitosensei replied to xenoalien's topic in PHP Coding Help
Here's how I'd do this echo $websitelink; // to make sure it's right see if it has the trailing / or not if($row['filetype']=='mp3') {$fileiconpath = $websitelink.'images/icons/music.png';} else {$fileiconpath = 'images/icons/page.png';} //================================================== echo $fileiconpath; // just to make sure it looks right echo "</td><td>"; echo "<center><img src='".$fileiconpath."'></center>"; echo "</td></tr>"; -
php 5.x fatal error with variable issue, help needed.
taquitosensei replied to APuppyDog's topic in PHP Coding Help
It will work and is good practice but the actual problem is with the reference to an array being returned from your function. -
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.
-
PHP Help -- Running other php scripts with variables
taquitosensei replied to bgeorge82's topic in PHP Coding Help
include supports variables. You just set the variable before you include the file $variable="BLAH"; include("echovariable.php"); echovariable.php echo $variable; -
[SOLVED] Get the date of the next upcoming Wednesday?
taquitosensei replied to ultrus's topic in PHP Coding Help
date("Y-m-d H:i:s", strtotime("next Wednesday")); -
php 5.x fatal error with variable issue, help needed.
taquitosensei replied to APuppyDog's topic in PHP Coding Help
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. -
php 5.x fatal error with variable issue, help needed.
taquitosensei replied to APuppyDog's topic in PHP Coding Help
no...more like $filename="listmycar.php"; if(file_exists($filename)) { $mypath=realpath($filename); } -
use css and divs for layout then use separate files and include them for header, lefthand menu, footer, etc..
-
php 5.x fatal error with variable issue, help needed.
taquitosensei replied to APuppyDog's topic in PHP Coding Help
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. -
turn on error reporting ini_set("display_errors","1"); ERROR_REPORTING(E_ALL); blank page usually means an error that isn't being displayed.
-
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.
-
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; }
-
[SOLVED] date_default_timezone_set not working
taquitosensei replied to chmpdog's topic in PHP Coding Help
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. -
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);
-
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.
-
bamboozled on cURL collection, http -> https broke me
taquitosensei replied to Gafcast's topic in PHP Coding Help
you'll probably still need a PEM certificate. -
bamboozled on cURL collection, http -> https broke me
taquitosensei replied to Gafcast's topic in PHP Coding Help
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]