[PHP] help with adding
I have messed with this for a couple of days and cant get it right. Maybe I need sleep :-) The code below is echoing the qty correctly (10, 5, 25) for ($i = 1; $i = $sendnum; $i++) { $qty = $_POST['qty'.$i]; echo $qty . 'br /'; } The question is, how would I take add each of these numbers (10+5+25)? Any help is appreciated.
[PHP] Video Uploads
I can upload just about everything with this script; but I don't understand why it says that the videos i try to upload are zero length. -- THE FORM -- form method=post name=info enctype=multipart/form-data id=x-form action=add.php input type=hidden name=max_size value=5120 input type=file name=form_data input type=submit name=submit value=Add Video/form -- THE SCRIPT -- ini_set ('display_errors', '1'); ini_set ('error_reporting', E_ALL); if (empty($_POST['submit'])) { include ('addform.php'); } else { $path = '/home/mydir/public_html/news/videos/'.$_FILES['form_data']['name']; $url = 'http://www.mysite.com/news/videos/'; $_POST = array_merge($_POST, $_FILES); if (!empty($_FILES['form_data']['name'])) { if ($_FILES['form_data']['size'] == 0) { echo 'Problem: '.$_FILES['form_data']['name'].' is zero length'; } if ($_FILES['form_data']['size'] $_POST['max_size']) { echo 'Problem: '.$_FILES['form_data']['name'].' is over '.$_POST['max_size'].' bytes.'; } if (!is_uploaded_file($_FILES['form_data']['tmp_name'])) { echo $_FILES['form_data']['name'].' is not uploaded.'; } move_uploaded_file($_FILES['form_data']['tmp_name'], $path); } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Video Uploads
The video is 1.5 meg and yes I can upload a PSD file that is 1.8.. Jay Minuk Choi wrote: How big are the video files(byte wise)? Have you tried uploading a non-video file of the same size? - Original Message - From: Jay Fitzgerald [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 09, 2004 12:10 PM Subject: [PHP] Video Uploads I can upload just about everything with this script; but I don't understand why it says that the videos i try to upload are zero length. -- THE FORM -- form method=post name=info enctype=multipart/form-data id=x-form action=add.php input type=hidden name=max_size value=5120 input type=file name=form_data input type=submit name=submit value=Add Video/form -- THE SCRIPT -- ini_set ('display_errors', '1'); ini_set ('error_reporting', E_ALL); if (empty($_POST['submit'])) { include ('addform.php'); } else { $path = '/home/mydir/public_html/news/videos/'.$_FILES['form_data']['name']; $url = 'http://www.mysite.com/news/videos/'; $_POST = array_merge($_POST, $_FILES); if (!empty($_FILES['form_data']['name'])) { if ($_FILES['form_data']['size'] == 0) { echo 'Problem: '.$_FILES['form_data']['name'].' is zero length'; } if ($_FILES['form_data']['size'] $_POST['max_size']) { echo 'Problem: '.$_FILES['form_data']['name'].' is over '.$_POST['max_size'].' bytes.'; } if (!is_uploaded_file($_FILES['form_data']['tmp_name'])) { echo $_FILES['form_data']['name'].' is not uploaded.'; } move_uploaded_file($_FILES['form_data']['tmp_name'], $path); } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Date Listing
?php for($i = 0; $i = 31; $i++) { $theday = strtotime(+$i day); echo 'option value=',date('Y-m-d',$theday),'',date('l, F j',$theday),'/option'; } ? Where $i = 31 is the number of days you want looped HTH Jay -Original Message- From: Pablo Zorzoli [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 2:47 PM To: [EMAIL PROTECTED] Subject: [PHP] Date Listing Hi everyone! Let's see if you can help me with this odd function i want to do. Imagine i have to dates,for example: $date1=2002-10-01 $date2= 2003-12-10 I want a function to list all the dates that are between these two. 2002-10-01 2002-10-02 2002-10-03 . . 2003-12-09 2003-12-10 Has anyone done something like this before. Thanks, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] echo or print
when should i use echo ' '; vs. print ' '; Jay Fitzgerald, Design Director - Certified Professional Webmaster (CPW-A) - Certified Professional Web Designer (CPWDS-A) - Certified Professional Web Developer (CPWDV-A) - Certified E-Commerce Manager (CECM-A) - Certified Small Business Web Consultant (CWCSB-A) Bayou Internet - http://www.bayou.com Toll Free: 888.30.BAYOU (22968) Vox: 318.338.2034 / Fax: 318.338.2506 E-Mail: [EMAIL PROTECTED] ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] To Loop or Not to Loop?
The code below inserts the same inventory item into the db multiple times - I just need 1 line entry for each inventory item, but multiple photos of each itemHow to do this? I know the code I wrote below is extremely awful, but I am a nebie and that was the only way I could get it to half-way do what I am wanting SNIP for($q=0;$q$tot;$q++) { $thefile = $_FILES['userfile']['name'][$q]; $temp_name = $_FILES['userfile']['tmp_name'][$q]; $thefile1 = $_FILES['userfile']['name']['0']; $thefile2 = $_FILES['userfile']['name']['1']; $thefile3 = $_FILES['userfile']['name']['2']; $thefile4 = $_FILES['userfile']['name']['3']; $thefile5 = $_FILES['userfile']['name']['4']; $thefile6 = $_FILES['userfile']['name']['5']; $thefile7 = $_FILES['userfile']['name']['6']; $thefile8 = $_FILES['userfile']['name']['7']; if (move_uploaded_file($temp_name, $uploaddir.'/'.$thefile)) { $connection = mysql_connect('localhost','*','*') or die ('Couldn\'t make connection.'); $db = mysql_select_db('*', $connection) or die ('Couldn\'t select database.'); $sql = INSERT INTO inventory ( id, status, stocknum, year, make, model, price, class, type, mileage, slides, extcolor, intcolor, awning, generator, bedsize, location, description, picname1, picname2, picname3, picname4, picname5, picname6, picname7, picname8 ) VALUES ( '', '$_POST[status]', '$_POST[stocknum]', '$_POST[year]', '$_POST[make]', '$_POST[model]', '$_POST[price]', '$_POST[class]', '$_POST[type]','$_POST[mileage]', '$_POST[slides]', '$_POST[extcolor]', '$_POST[intcolor]', '$_POST[awning]', '$_POST[generator]', '$_POST[bedsize]', '$_POST[location]', '$_POST[description]', '$thefile1', '$thefile2', '$thefile3', '$thefile4', '$thefile5', '$thefile6', '$thefile7', '$thefile8' ); $sql_result = mysql_query($sql) or die ('Couldn\'t execute query.'); if (!$sql_result) { echo 'Could not add inventory.p'; exit; } $invfile = $thepath/$thefile; } else { $invfile = $thepath/$spacer; } ? img src=?= $invfile; ?br / ?php } $myid = mysql_insert_id(); mysql_close($connection); /SNIP Jay Fitzgerald, Design Director - Certified Professional Webmaster (CPW-A) - Certified Professional Web Designer (CPWDS-A) - Certified Professional Web Developer (CPWDV-A) - Certified E-Commerce Manager (CECM-A) - Certified Small Business Web Consultant (CWCSB-A) Bayou Internet - http://www.bayou.com Toll Free: 888.30.BAYOU (22968) Vox: 318.338.2034 / Fax: 318.338.2506 E-Mail: [EMAIL PROTECTED] ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Multiple Image Uploads
Can someone help me with this? I've been trying to get it to work all day :( http://codedump.phpfreaks.com/viewcode.php?id=2061 Jay Fitzgerald, Design Director - Certified Professional Webmaster (CPW-A) - Certified Professional Web Designer (CPWDS-A) - Certified Professional Web Developer (CPWDV-A) - Certified E-Commerce Manager (CECM-A) - Certified Small Business Web Consultant (CWCSB-A) Bayou Internet - http://www.bayou.com Toll Free: 888.30.BAYOU (22968) Vox: 318.338.2034 / Fax: 318.338.2506 E-Mail: [EMAIL PROTECTED] ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Multiple Image Uploads
I tried posting my code to the list but there are around 800+ lines of code and my email keeps bouncingi am open to suggestions? Jay At 06:59 PM 11/6/2003 -0800, you wrote: I'm with Jason. I was curious as to the subject but I will not click on the link. Justin MacLeod -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED] Sent: November 6, 2003 5:25 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Multiple Image Uploads On Friday 07 November 2003 05:10, Jay Fitzgerald wrote: Can someone help me with this? I've been trying to get it to work all day :( http://codedump.phpfreaks.com/viewcode.php?id=2061 Please include your code as inline text in your post. You'll reach a wider audience as many people will not be inclined to click on links. Also, as the above link may be invalid in the future then people reading this in the archives will have no idea what your question is about. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* We'll cross that bridge when we come back to it later. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to?
I need to create a form for this example in php. I need to have an unlimited number of seats with radio buttons next to each seat for the user to be able to select. BUT, when the user visits this page, it needs to pull the seats taken from the db and cross them out, rendering them inoperable without the radio button... http://www.lanhorizon.com/step17.php is there a way to do this? the logic seems easy, but actually making it work is another story... TIA Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Need Help - past deadline
Ok - Thanks to Jim Lucas off list - I am almost to where i want to be, but i am unable to reach him for further assistance. Can someone tell me where in this code I can add a grey table row seperator? AND how come only the first seat from my database is being displayed as taken? $alphabet = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q'); $rowCount = 14; $totalSeats = 238; $connection = mysql_connect(localhost,**,***) or die (Couldn't make connection.); $db = mysql_select_db(registration, $connection) or die (Couldn't select database.); $sql = SELECT seat, alias FROM attendees; $sql_result = mysql_query($sql,$connection) or die(Couldn't execute query.); $row = mysql_fetch_array($sql_result); $alias = $row['alias']; ? center table class=seattable width=650 ?php for($i=0; $i$totalSeats; $i++) { $val = $i + 1; if($i % $rowCount) { echo td align=\center\ valign=\middle\ ; } else { echo tr; echo td align=\center\ valign=\middle\ class=\rowheader\; echo $alphabet[($i / $rowCount)]; echo /td; echo td ; } if(in_array($val, $row)) { echo class=\closed\a class=\sold\ title=\SOLD TO $alias\ onMouseOver=\self.status='SOLD TO .$alias.'; return true;\ onMouseOut=\self.status=' '; return true;\; echo {$alias}; } else { echo class=\open\; echo input type=\radio\ name=\seat\ value=\{$val}\font class=\avail\{$val}/font; } if($i % $rowCount + 1) { echo /td; } else { echo /td/tr; } } ? /table /center here is what I am wanting to add - I tried placing this in several places in this code so far (top, middle bottom) but whenever i add it, the output gets totally fudged tr td class=rowspacenbsp;/TD td class=space colspan=15nbsp;/td /tr but I also need it to display ALL of the seats that are in the db as being sold and not just the first row... TIA Jay Fitzgerald, Design Director - Certified Professional Webmaster (CPW-A) - Certified Professional Web Designer (CPWDS-A) - Certified Professional Web Developer (CPWDV-A) - Certified E-Commerce Manager (CECM-A) - Certified Small Business Web Consultant (CWCSB-A) Bayou Internet - http://www.bayou.com/http://www.bayou.com Toll Free: 888.30.BAYOU (22968) Vox: 318.338.2034 / Fax: 318.338.2506 E-Mail: mailto:[EMAIL PROTECTED][EMAIL PROTECTED] ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf
RE: [PHP] Need Help - past deadline
Ok - Thanks to Jim Lucas off list - I am almost to where i want to be, but i am unable to reach him for further assistance. Can someone tell me where in this code I can add a grey table row seperator? AND how come only the first seat from my database is being displayed as taken? $alphabet = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q'); $rowCount = 14; $totalSeats = 238; $connection = mysql_connect(localhost,**,***) or die (Couldn't make connection.); $db = mysql_select_db(registration, $connection) or die (Couldn't select database.); $sql = SELECT seat, alias FROM attendees; $sql_result = mysql_query($sql,$connection) or die(Couldn't execute query.); $row = mysql_fetch_array($sql_result); $alias = $row['alias']; ? center table class=seattable width=650 ?php for($i=0; $i$totalSeats; $i++) { $val = $i + 1; if($i % $rowCount) { echo td align=\center\ valign=\middle\ ; } else { echo tr; echo td align=\center\ valign=\middle\ class=\rowheader\; echo $alphabet[($i / $rowCount)]; echo /td; echo td ; } if(in_array($val, $row)) { echo class=\closed\a class=\sold\ title=\SOLD TO $alias\ onMouseOver=\self.status='SOLD TO .$alias.'; return true;\ onMouseOut=\self.status=' '; return true;\; echo {$alias}; } else { echo class=\open\; echo input type=\radio\ name=\seat\ value=\{$val}\font class=\avail\{$val}/font; } if($i % $rowCount + 1) { echo /td; } else { echo /td/tr; } } ? /table /center here is what I am wanting to add - I tried placing this in several places in this code so far (top, middle bottom) but whenever i add it, the output gets totally fudged tr td class=rowspacenbsp;/TD td class=space colspan=15nbsp;/td /tr but I also need it to display ALL of the seats that are in the db as being sold and not just the first row... TIA Jay Fitzgerald, Design Director - Certified Professional Webmaster (CPW-A) - Certified Professional Web Designer (CPWDS-A) - Certified Professional Web Developer (CPWDV-A) - Certified E-Commerce Manager (CECM-A) - Certified Small Business Web Consultant (CWCSB-A) Bayou Internet - http://www.bayou.com Toll Free: 888.30.BAYOU (22968) Vox: 318.338.2034 / Fax: 318.338.2506 E-Mail: [EMAIL PROTECTED] ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need help - past deadline
Ok - Thanks to everyone who has helped me so far both on and off-list - I am almost to where i want to be, but i am unable to reach him for further assistance. Can someone tell me where in this code I can add a grey table row seperator (as shown at the bottom)? AND how come only the first seat from my database is being displayed as taken? $alphabet = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q'); $rowCount = 14; $totalSeats = 238; $connection = mysql_connect(localhost,**,***) or die (Couldn't make connection.); $db = mysql_select_db(registration, $connection) or die (Couldn't select database.); $sql = SELECT seat, alias FROM attendees; $sql_result = mysql_query($sql,$connection) or die(Couldn't execute query.); $row = mysql_fetch_array($sql_result); $alias = $row['alias']; ? center table class=seattable width=650 ?php for($i=0; $i$totalSeats; $i++) { $val = $i + 1; if($i % $rowCount) { echo td align=\center\ valign=\middle\ ; } else { echo tr; echo td align=\center\ valign=\middle\ class=\rowheader\; echo $alphabet[($i / $rowCount)]; echo /td; echo td ; } if(in_array($val, $row)) { echo class=\closed\a class=\sold\ title=\SOLD TO $alias\ onMouseOver=\self.status='SOLD TO .$alias.'; return true;\ onMouseOut=\self.status=' '; return true;\; echo {$alias}; } else { echo class=\open\; echo input type=\radio\ name=\seat\ value=\{$val}\font class=\avail\{$val}/font; } if($i % $rowCount + 1) { echo /td; } else { echo /td/tr; } } ? /table /center here is what I am wanting to add - I tried placing this in several places in this code so far (top, middle bottom) but whenever i add it, the output gets totally fudged tr td class=rowspacenbsp;/TD td class=space colspan=15nbsp;/td /tr but I also need it to display ALL of the seats that are in the db as being sold and not just the first row... TIA Jay At 12:00 PM 8/26/2003 -0800, you wrote: [clip] if ($i = 84) { ? td align=center valign=top class=greeninput type=radio name=seat value=?php print $i++; ?nobr /font class=avail?php print $i++; ?/td ?php } } } ? [/clip] ?php print $i++; ? prints out the value of $i as well as incrementing it twice. Did you notice in your code that the input type=radio name=seat value={one less than...} ... {this}/td HTH, -Michael Jay Fitzgerald, Design Director - Certified Professional Webmaster (CPW-A) - Certified Professional Web Designer (CPWDS-A) - Certified Professional Web Developer (CPWDV-A) - Certified E-Commerce Manager (CECM-A) - Certified Small Business Web Consultant (CWCSB-A) Bayou Internet - http://www.bayou.com Toll Free: 888.30.BAYOU (22968) Vox: 318.338.2034 / Fax: 318.338.2506 E-Mail: [EMAIL PROTECTED] ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] multiple mailings
sorry for the multiple mailings...I'm not meaning to spam the list, but apparently when i send an email to the list, it takes almost 2 hours for me to receive a copy of it letting me know that it went through ok Jay Fitzgerald, Design Director - Certified Professional Webmaster (CPW-A) - Certified Professional Web Designer (CPWDS-A) - Certified Professional Web Developer (CPWDV-A) - Certified E-Commerce Manager (CECM-A) - Certified Small Business Web Consultant (CWCSB-A) Bayou Internet - http://www.bayou.com Toll Free: 888.30.BAYOU (22968) Vox: 318.338.2034 / Fax: 318.338.2506 E-Mail: [EMAIL PROTECTED] ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] if seat is sold
1. here is my code: http://codedump.phpfreaks.com/viewcode.php?id=1162 2. here is a screenie of my seating chart: http://www.bayou.com/jay/chart.gif 3. what i am wanting to do is using CSS i want to strike-through the seats that are in the db - else, I want them to display normally note: the seat numbers are not in the db unless someone chooses that seatthey are a while loop of numbers 1 through 240 Anyone got any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] please help past deadline
can someone please look at my code below and tell me why it is only working half-way? It is only displaying radio buttons and seats for numbers 71, 73, 75, 77, 79, 81, 83, and 85.and it is printing seat # 76 since that is the one in the database between seats 81 and 83why is this happenening and HOW can i correct it??? $sql = SELECT seat, alias FROM attendees; $sql_result = mysql_query($sql,$connection) or die(Couldn't execute query.); $row = mysql_fetch_array($sql_result); $myseat = array('70','71','72','73','74','75','76','77','78','79','80','81','82','83','84'); $i = 70; foreach ($myseat as $seat) { if (($seat) == ($row[0])) { if ($i = 84) { ? td align=center valign=top class=reda class=sold onMouseOver=self.status='SOLD TO ?php echo $alias; ?'; return true; onMouseOut=self.status=' '; return true;?php print $row[0]; ?/td ?php } } else { if ($i = 84) { ? td align=center valign=top class=greeninput type=radio name=seat value=?php print $i++; ?nobr /font class=avail?php print $i++; ?/td ?php } } } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] need help - past deadline
can someone please look at my code below and tell me why it is only working half-way? It is only displaying radio buttons and seats for numbers 71, 73, 75, 77, 79, 81, 83, and 85.and it is printing seat # 76 since that is the one in the database between seats 81 and 83why is this happenening and HOW can i correct it??? $sql = SELECT seat, alias FROM attendees; $sql_result = mysql_query($sql,$connection) or die(Couldn't execute query.); $row = mysql_fetch_array($sql_result); $myseat = array('70','71','72','73','74','75','76','77','78','79','80','81','82','83','84'); $i = 70; foreach ($myseat as $seat) { if (($seat) == ($row[0])) { if ($i = 84) { ? td align=center valign=top class=reda class=sold onMouseOver=self.status='SOLD TO ?php echo $alias; ?'; return true; onMouseOut=self.status=' '; return true;?php print $row[0]; ?/td ?php } } else { if ($i = 84) { ? td align=center valign=top class=greeninput type=radio name=seat value=?php print $i++; ?nobr /font class=avail?php print $i++; ?/td ?php } } } ? Jay Fitzgerald, Design Director - Certified Professional Webmaster (CPW-A) - Certified Professional Web Designer (CPWDS-A) - Certified Professional Web Developer (CPWDV-A) - Certified E-Commerce Manager (CECM-A) - Certified Small Business Web Consultant (CWCSB-A) Bayou Internet - http://www.bayou.com/http://www.bayou.com Toll Free: 888.30.BAYOU (22968) Vox: 318.338.2034 / Fax: 318.338.2506 E-Mail: mailto:[EMAIL PROTECTED][EMAIL PROTECTED] ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf
[PHP] Need help - past deadline
can someone please look at my code below and tell me why it is only working half-way? It is only displaying radio buttons and seats for numbers 71, 73, 75, 77, 79, 81, 83, and 85.and it is printing seat # 76 since that is the one in the database between seats 81 and 83why is this happenening and HOW can i correct it??? $sql = SELECT seat, alias FROM attendees; $sql_result = mysql_query($sql,$connection) or die(Couldn't execute query.); $row = mysql_fetch_array($sql_result); $myseat = array('70','71','72','73','74','75','76','77','78','79','80','81','82','83','84'); $i = 70; foreach ($myseat as $seat) { if (($seat) == ($row[0])) { if ($i = 84) { ? td align=center valign=top class=reda class=sold onMouseOver=self.status='SOLD TO ?php echo $alias; ?'; return true; onMouseOut=self.status=' '; return true;?php print $row[0]; ?/td ?php } } else { if ($i = 84) { ? td align=center valign=top class=greeninput type=radio name=seat value=?php print $i++; ?nobr /font class=avail?php print $i++; ?/td ?php } } } ? Jay Fitzgerald, Design Director - Certified Professional Webmaster (CPW-A) - Certified Professional Web Designer (CPWDS-A) - Certified Professional Web Developer (CPWDV-A) - Certified E-Commerce Manager (CECM-A) - Certified Small Business Web Consultant (CWCSB-A) Bayou Internet - http://www.bayou.com/http://www.bayou.com Toll Free: 888.30.BAYOU (22968) Vox: 318.338.2034 / Fax: 318.338.2506 E-Mail: mailto:[EMAIL PROTECTED][EMAIL PROTECTED] ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf
[PHP] Freelance code optimizations
I have written an online event registration system and I am curious to know if there is anyone out there who could either take my code and optimize it for me or basically help me learn how to optimize my code off-list. I am a php nub and I know there are probably all kinds of bugs and duplications in my code but I think I have coded it free of all errors, warnings and notices. I would rather someone help me learn basic optimization techniques like functions and such off list because I would hate to have to keep spending money to have my code optimized I am a somewhat slow learner in that I cannot learn from reading - the stuff on functions, for example, is confusing to me - I can only learn by examples with explanations of why certain things are done. If ya'll think I will be too much of a pain to help, I will understand - but I would like to learn == Jay Fitzgerald, Design Director - Certified Professional Webmaster (CPW-A) - Certified Professional Web Designer (CPWDS-A) - Certified Professional Web Developer (CPWDV-A) - Certified E-Commerce Manager (CECM-A) - Certified Small Business Web Consultant (CWCSB-A) Bayou Internet - http://www.bayou.com/ http://www.bayou.com Toll Free: 888.30.BAYOU (22968) Vox: 318.338.2034 / Fax: 318.338.2506 E-Mail: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf ==
[PHP] Functions in Safe Mode
My code: echo number_format(filesize(news/final_1.txt)); The Warning: Warning: filesize() [ http://www.php.net/function.filesize function.filesize]: SAFE MODE Restriction in effect. The script whose uid is 17704 is not allowed to access news/final_1.txt owned by uid 65534 in /home/***/public_html/news.php on line 10 0 The Question: Is there a way to get the file size of files if safe mode is on? I need to do an IF/ELSE statement so that if the file size is less than a certain size, then it does not display the text contained in that file. Am I going about this the wrong way? Jay Fitzgerald, Design Director - Certified Professional Webmaster (CPW-A) - Certified Professional Web Designer (CPWDS-A) - Certified Professional Web Developer (CPWDV-A) - Certified E-Commerce Manager (CECM-A) - Certified Web Consultant for Small Business (CWCSB-A) Bayou Internet - http://www.bayou.com http://www.bayou.com/ Toll Free: 888.30.BAYOU (22968) Vox: 318.338.2034 / Fax: 318.338.2506 E-Mail: [EMAIL PROTECTED] ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf
[PHP] Functions in Safe Mode?
My code: echo number_format(filesize(news/final_1.txt)); The Warning: Warning: filesize() [ http://www.php.net/function.filesize function.filesize]: SAFE MODE Restriction in effect. The script whose uid is 17704 is not allowed to access news/final_1.txt owned by uid 65534 in /home/***/public_html/news.php on line 10 0 The Question: Is there a way to get the file size of files if safe mode is on? I need to do an IF/ELSE statement so that if the file size is less than a certain size, then it does not display the text contained in that file. Am I going about this the wrong way? -- Jay Fitzgerald, Design Director - CPW-A, CPWDS-A, CPWDV-A, CECM-A, CWCSB-A Bayou Internet - http://www.bayou.com Toll Free: 888.30.BAYOU (22968) Vox: 318.338.2034 / Fax: 318.338.2506 E-Mail: [EMAIL PROTECTED] ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] echo statements
When echoing html code that will include variables from a while or if loop, which method is best? Method 1: echo td align=\left\ VALIGN=\top\font class=\dbtables\$employer/font/td; OR Method 2: td align=left valign=topfont class=dbtables?php echo $employer; ?/font/td If you would, please give reasons why to support your opinion. Thanks -- Jay Fitzgerald, Design Director - CPW-A, CPWDS-A, CPWDV-A, CECM-A, CWCSB-A Bayou Internet - http://www.bayou.com Toll Free: 888.30.BAYOU (22968) Vox: 318.338.2034 / Fax: 318.338.2506 E-Mail: [EMAIL PROTECTED] ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Another newbie
I have been writing PHP for almost a year now and someone on phpfreaks told me the other day that my code was very sloppy. Since I want to more more into programming than design, can anyone recommend where to learn how to make sure your code is clean, optimized and as error-free as it can get? Even if it is the style of how to write the code, please let me knowI know noone can be the perfect programmer, but I would at least like to be a decent programmer :) Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] script check/testing
I seem to be having problem in the last step of this app I am trying to create...can you guys test it as thoroughly as you can and give me tips on how to improve itit is session based but I cannot seem to get step 5 to recognize the $theseat variable. If you would like to offer help, please email me off-list and I will provide the code to you, there is way to much code and I am not even sure which part I should post here. http://www.lamerc.com/jay/test/new/step1.php TIA Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] am i doing this right?
This is the code I have that is on step 4 of an event registration system i am working on... [code page=step4.php] ini_set(display_errors, 1); ini_set ('error_reporting', E_ALL); session_start (); $ip = $_SERVER['REMOTE_ADDR']; $fullhost = gethostbyaddr($ip); $host = preg_replace(/^[^.]+./, *., $fullhost); $_SESSION['host'] = $fullhost; $_SESSION['ip'] = $ip; $_SESSION['eventid'] = $_SESSION['eventid']; $_SESSION['age'] = $_SESSION['age']; $_SESSION['terms'] = $_SESSION['terms']; $_SESSION['team'] = $_REQUEST['team']; for($i = 0; $i = 239; $i++): $seat = array('A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8', 'A9', 'A10', 'A11', 'A12', 'A13', 'A14', 'A15', 'A16', 'A17', 'A18', 'A19', 'A20', 'B21', 'B22', 'B23', 'B24', 'B25', 'B26', 'B27', 'B28', 'B29', 'B30', 'B31', 'B32', 'B33', 'B34', 'B35', 'B36', 'B37', 'B38', 'B39', 'B40', 'C41', 'C42', 'C43', 'C44', 'C45', 'C46', 'C47', 'C48', 'C49', 'C50', 'C51', 'C52', 'C53', 'C54', 'C55', 'C56', 'C57', 'C58', 'C59', 'C60', 'D61', 'D62', 'D63', 'D64', 'D65', 'D66', 'D67', 'D68', 'D69', 'D70', 'D71', 'D72', 'D73', 'D74', 'D75', 'D76', 'D77', 'D78', 'D79', 'D80', 'D81', 'D82', 'D83', 'D84', 'D85', 'D86', 'D87', 'D88', 'D89', 'D90', 'E91', 'E92', 'E93', 'E94', 'E95', 'E96', 'E97', 'E98', 'E99', 'E100', 'E101', 'E102', 'E103', 'E104', 'E105', 'E106', 'E107', 'E108', 'E109', 'E110', 'F111', 'F112', 'F113', 'F114', 'F115', 'F116', 'F117', 'F118', 'F119', 'F120', 'G121', 'G122', 'G123', 'G124', 'G125', 'G126', 'G127', 'G128', 'G129', 'G130', 'H131', 'H132', 'H133', 'H134', 'H135', 'H136', 'H137', 'H138', 'H139', 'H140', 'H141', 'H142', 'H143', 'H144', 'H145', 'H146', 'H147', 'H148', 'H149', 'H150', 'I151', 'I152', 'I153', 'I154', 'I155', 'I156', 'I157', 'I158', 'I159', 'I160', 'I161', 'I162', 'I163', 'I164', 'I165', 'I166', 'I167', 'I168', 'I169', 'I170', 'I171', 'I172', 'I173', 'I174', 'I175', 'I176', 'I177', 'I178', 'I179', 'I180', 'J181', 'J182', 'J183', 'J184', 'J185', 'J186', 'J187', 'J188', 'J189', 'J190', 'J191', 'J192', 'J193', 'J194', 'J195', 'J196', 'J197', 'J198', 'J199', 'J200', 'K201', 'K202', 'K203', 'K204', 'K205', 'K206', 'K207', 'K208', 'K209', 'K210', 'K211', 'K212', 'K213', 'K214', 'K215', 'K216', 'K217', 'K218', 'K219', 'K220', 'L221', 'L222', 'L223', 'L224', 'L225', 'L226', 'L227', 'L228', 'L229', 'L230', 'L231', 'L232', 'L233', 'L234', 'L235', 'L236', 'L237', 'L238', 'L239', 'L240'); echo A HREF=\step5.php?seat=$seat[$i]\$seat[$i]/ABR; endfor; [/end code] Now - all of that works perfect and it displays seperate lines with links to each $seat in the browsereven when I click on the link and goto step 5, it seems as though it is working correctly... [code page=step5.php] session_start (); $_SESSION['seat'] = $_REQUEST['seat']; echo $_SESSION[seat]; [/end code] My question is - is my session working correctly? am I doing what I need to be doing in order to keep the seats secure so that noone can just type the seat number in the location bar and get to register their seat? The reson I ask this is because the only way I know to test sessions is to close out my browser completely, reopen it and try going to the page I am testing...HOWEVER, when I do that in this situation, I am still allowed to change the actual seat number in my location barthis is what I do NOT want... I have read and read and read online and every place I have looked says the same stuff that the way I have it above should be secure, but apparently it is not... TIA, Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing Variables
I have been searching for an answer to this for a couple of hours now and cant find anything. I believe that there is a secure way of doing this but I think my brain is having a momentary lapse... I have these variables: $eventid = 1; $age = 15; Is there a way to pass these variables to the next page so I can continue using them without doing something like this: A HREF=test.php?eventid=1age=15 I would rather not have the variables be seen or known to the end user for security reasons because they could change them in the URL. I know it has something to do with $_GET and $_POST because I do have register_globals set to OFF in my php file and I do not want to turn them on TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Passing Variables
That was my thought too, George. But if the user does not have cookies enabled, then I believe, as Thomas pointed out, that a SESSION is the only way to handle the variables. I have never done a correct session so I am trying to learn how to do them without having a userid and password for each user. I have played with sessions but I don't know if I am doing them correctly or how to do sessions without authentication. Jay At 03:14 PM 6/21/2003 +0100, George Pitcher wrote: Nabil, That is one way but it means that Jay would have to use a form and not a link. You could set a cookie. That would work, but it relies on the user allowing cookies. George -Original Message- From: nabil [mailto:[EMAIL PROTECTED] Sent: 21 June 2003 2:58 pm To: [EMAIL PROTECTED] Subject: [PHP] Re: Passing Variables use hidden field (pure html) and then u have it as $yourhiddenfield on the next page even u have the register global off.. Nabil Jay Fitzgerald [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have been searching for an answer to this for a couple of hours now and cant find anything. I believe that there is a secure way of doing this but I think my brain is having a momentary lapse... I have these variables: $eventid = 1; $age = 15; Is there a way to pass these variables to the next page so I can continue using them without doing something like this: A HREF=test.php?eventid=1age=15 I would rather not have the variables be seen or known to the end user for security reasons because they could change them in the URL. I know it has something to do with $_GET and $_POST because I do have register_globals set to OFF in my php file and I do not want to turn them on TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] correct session format?
is this the correct way to register variables via a session? [code] session_start (); $_SESSION['eventid'] = 'arma2'; print_r ($_SESSION); echo P $_SESSION; [/code] [result] Array ( [eventid] = arma2 ) Array [/result] I apologize for the numerous questions, but I am trying to learn...If anyone would like to help off-list, my ICQ is 38823829 Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] correct session format?
what about for version 4.3.1?? Jay At 01:41 PM 6/22/2003 +1000, you wrote: Yes, for PHP = 4.1 Justin on 22/06/03 12:22 AM, Jay Fitzgerald ([EMAIL PROTECTED]) wrote: is this the correct way to register variables via a session? [code] session_start (); $_SESSION['eventid'] = 'arma2'; print_r ($_SESSION); echo P $_SESSION; [/code] [result] Array ( [eventid] = arma2 ) Array [/result] I apologize for the numerous questions, but I am trying to learn...If anyone would like to help off-list, my ICQ is 38823829 Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Seating chart registration system?
I am writing a php event registration system for lanparties and I believe I have everything written that I need except for a seating selection chart. I dont want to reinvent the wheel if I dont have to and am curious to know if something like this has already been written as public source... If not, I possibly may pay a reasonable fee for one or for someone to write it for me...Here is what I need and maybe you could provide a direction for me to do research or some logic as to how it can be done... As a person goes through the event registration system, they will come to a page that displays 8 rows of 30 seats (240 seats total)...but in the future I would like to have admin capability to increase or decrease this amount. When they get to that page it should display all of the open or available seats in one color and all of the sold or reserved seats in a different color. The registrant will then select an open seat they wish to buy or reserve and then take them to the next step in registration where they enter their attendee information and pay to attend via paypal or mollyguard. Then when the next person decides to register, when they get to that page, one less seat will be available. I would like to have as much control as possible and I do know a minor bit of php and mysql. Any help or guidance is appreciated. Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] preg_match_all
How do I create a preg_match for something like this? TD CLASS=time ALIGN=CENTER VALIGN=MIDDLE!-- insert time -- B7 PM/B/TD TD BGCOLOR=#BFD8F6IMG SRC=spacer.gif WIDTH=1 HEIGHT=1 BORDER=0 ALT=/TD I want to store the individual times in an array and then loop through them if that makes sense... I tried this but when i try to echo the results back out it doesnt work ? preg_match_all(|TD CLASS=\time\ ALIGN=\CENTER\ VALIGN=\MIDDLE\!-- insert time -- B(.*)/B/TD\n TD BGCOLOR=\#BFD8F6\IMG SRC=\spacer.gif\ WIDTH=\1\ HEIGHT=\1\ BORDER=\0\ ALT=\\/TD\n|U,$read,$result); ? ? echo $result[1][0]; ? Jay Fitzgerald, Design Director - CPW-A, CPWDS-A, CPWDV-A, CECM-A, CWCSB-A Bayou Internet - http://www.bayou.com Toll Free: 888.30.BAYOU (22968) Vox: 318.338.2034 / Fax: 318.338.2506 E-Mail: [EMAIL PROTECTED] ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Auto-Date Select Box
Does anyone know how I can make a PHP form select box that has the dates in it for the next 7 days including today and the remaining days from this week? eg: SELECT NAME=date OPTION VALUE=2003-04-05Friday, April 5 OPTION VALUE=2003-04-06Saturday, April 6 OPTION VALUE=2003-04-07Sunday, April 7 OPTION VALUE=2003-04-08Monday, April 8 OPTION VALUE=2003-04-09Tuesday, April 9 OPTION VALUE=2003-04-10Wednesday, April 10 OPTION VALUE=2003-04-11Thursday, April 11 OPTION VALUE=2003-04-12Friday, April 12 OPTION VALUE=2003-04-05Saturday, April 13 OPTION VALUE=2003-04-05Sunday, April 14 /SELECT Jay Fitzgerald, Design Director Bayou Internet - http://www.bayou.com Toll Free: 888.30.BAYOU (22968) Vox: 318.338.2034 / Fax: 318.338.2506 E-Mail: [EMAIL PROTECTED] ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Rounding Time
I apologize in advance for my constant nub questions.. How can I round the current time up or down to the nearest 1/2 hour? eg: timeranges: 0900 through 0915 == 0900 0916 through 0930 == 0930 0931 through 0945 == 0930 0946 through 1000 == 1000 Jay Fitzgerald, Design Director Bayou Internet - http://www.bayou.com Toll Free: 888.30.BAYOU (22968) Vox: 318.338.2034 / Fax: 318.338.2506 E-Mail: [EMAIL PROTECTED] ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Another time around
I'm getting close to what I want...I currently have this code which loops through all of the next 24 hours: SELECT NAME=futhour ? for($i = 0; $i = 24; $i++): $futhour = strtotime(+$i hour); echo 'OPTION VALUE='. date('H',$futhour) .''. date('g a',$futhour).'/OPTION'; endfor; ? /SELECT is there a way to include the minutes of the hour in the above code, BUT have the minutes rounded to the nearest 1/2 hour? e.g.: 12:00 12:30 1:00 1:30 Jay Fitzgerald, Design Director - CPW-A, CPWDS-A, CPWDV-A, CECM-A, CWCSB-A Bayou Internet - http://www.bayou.com Toll Free: 888.30.BAYOU (22968) Vox: 318.338.2034 / Fax: 318.338.2506 E-Mail: [EMAIL PROTECTED] ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP preg_match_all()
I am having to edit a php script that one of our previous employees had written and I am having a problem understanding the preg_match_all function. preg_match_all(|img src=/news/(.*)|U, $read, $result2); here is what I THINK I know: The | at the beginning signifies the start of the text to search for, then the actual text to search img src=/news/(.*) - the (.*) means to include everything after the / in the search as wellwhat I dont quite understand is what the |U is actually doingthen it tells the function what variable to $read and what new variable to store in: $result2 can anyone fill me in if my logic is not correct and what exactly the |U is doing in this function? Jay Fitzgerald, Design Director - CPW-A, CPWDS-A, CPWDV-A, CECM-A, CWCSB-A Bayou Internet - http://www.bayou.com Toll Free: 888.30.BAYOU (22968) Vox: 318.338.2034 / Fax: 318.338.2506 E-Mail: [EMAIL PROTECTED] ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] WHILE IF/ELSE loop not working
can anyone tell me why this while loop fails? == while ($row = mysql_fetch_array($sql_result)): $phone = $row[phone]; $date = $row[date]; if ($phone == $_POST[areacode]$_POST[prefix]$_POST[suffix]): if ($date == NULL): $date = today; echo BICongratulations!/B/I P B$_POST[areacode]-$_POST[prefix]-$_POST[suffix]/B is qualified with an available date of nbsp;B$date/B. ; elseif ($date != NULL): echo BICongratulations!/I/B P B$_POST[areacode]-$_POST[prefix]-$_POST[suffix]/B is qualified with a first available date of nbsp;B$date/B. ; else: echo BSorry! $_POST[areacode]-$_POST[prefix]-$_POST[suffix]/B is not available at this time.; endif; endif; endwhile; == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Login Sessions
What am I doing wrong here? I have a login form that visitors enter their usename and use_psswrd in to log in...the form action is this code: SNIP 1== ? session_start(); if ($_REQUEST[use_name] $_REQUEST[use_psswrd]) { $connection = mysql_connect(SERVER,USER,PASS) or die (Couldn't make connection.); $db = mysql_select_db(DB, $connection) or die (Couldn't select the database.); $sql = select * from TABLE where use_name = '$_REQUEST[use_name]' and use_psswrd = '$_REQUEST[use_psswrd]'; $sql_result = mysql_query($sql) or die (Couldn't execute query.); if (mysql_num_rows($sql_result) 0 ) { list($valid_id, $valid_user) = mysql_fetch_row($sql_result); session_register(valid_id, valid_user); // echo $valid_id, $valid_user; header(Location: modify_profile.php?uid=$valid_idun=$valid_user); } else { header(Location: profile_login.php); exit; } } mysql_free_result($sql_result); mysql_close($connection); ? ==END SNIP 1=== That page is supposed to register a session that holds both the valid_id and valid_user variables and continue on the the next page (which it does) - BUT once the user gets to the next page: ===SNIP 2 ? session_start(); if (isset(valid_id)) { echo $_SESSION[valid_id]P; } else { echo DUMBASS!; } ? ==END SNIP 2=== Nothing gets displayed.Am I not setting or requesting them correctly?? The one thing I cant understand is why the URI now reflects the user is logged in: (modify_profile.php?uid=1un=jerry) TIA, Jay
[PHP] E-Commerce and small intranet solution
Does anyone know where I can find the best (not just good) shopping cart solution that also has small intranet functionality? Im not too worried about the intranet aspect right now, but I really need examples of some of the best carts that are out there. -- Should you have any questions, comments or concerns, feel free to call me at 318-338-2034. Thank you for your time, Jay Fitzgerald, Design Director - CSBW-A, CPW-A, CWD-A, CEMS-A = Bayou Internet..(888) 30-BAYOU...http://www.bayou.com Mississippi Internet...(800) MISSISSIPPIhttp://www.mississippi.net Vicksburg Online..(800) MISSISSIPPIhttp://www.vicksburg.com Bama Online.(877) GETCONNECTED...http://www.bamaonline.net = Tel: (318) 338-2034ICQ: 38823829Fax: (318) 323-5053 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Security
Can someone point me in the right direction in determining just how secure PHP really is? Should you have any questions, comments or concerns, feel free to call me at 318-338-2034. Thank you for your time, Jay Fitzgerald, Design Director - CSBW-A, CPW-A, CWD-A, CEMS-A == Bayou Internet..(888) 30-BAYOUhttp://www.bayou.com Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net Vicksburg Online..(800) MISSISSIPPIhttp://www.vicksburg.com == Tel: (318) 338-2034ICQ: 38823829 Fax: (318) 323-5053 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: PHP/MySQL/XML
OkThanks to all those who are helping me (sorry for cross-posting)... My scripts are working great except for one thingwhen it queries the db there are some fields that have a NULL value, thus when it writes the XML file it does this: null_field/null_field What I would like to do is either place an nbsp; in the XML tags for all of these NULL fields - can I do an if / else statement in the code I am using below?? $phone_list = fopen(/usr/local/apache2/htdocs/test/phone_list.xml, w+); fwrite($phone_list, ?xml version=\1.0\ encoding=\ISO-8859-1\?\n); fwrite($phone_list, ?xml-stylesheet type=\text/xsl\ href=\phone_list.xsl\?\n\n); fwrite($phone_list, test\n); fwrite($phone_list, \tphone_list\n); while ($row = mysql_fetch_array($sql_result)) { $name = $row[name]; $ext = $row[ext]; $title = $row[title]; $home = $row[home]; $pager = $row[pager]; $cell = $row[cell]; $email = $row[email]; fwrite($phone_list, \t\temployee\n); fwrite($phone_list, \t\t\tname); fwrite($phone_list, $name); fwrite($phone_list, /name\n); fwrite($phone_list, \t\t\text); // would need an if / else statement here fwrite($phone_list, $ext); // end if / else statement here fwrite($phone_list, /ext\n); } fwrite($phone_list, \t/phone_list\n); fwrite($phone_list, /test); fclose($phone_list); ? Should you have any questions, comments or concerns, feel free to call me at 318-338-2034. Thank you for your time, Jay Fitzgerald, Design Director - CSBW-A, CPW-A, CWD-A, CEMS-A == Bayou Internet..(888) 30-BAYOUhttp://www.bayou.com Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net Vicksburg Online..(800) MISSISSIPPIhttp://www.vicksburg.com == Tel: (318) 338-2034ICQ: 38823829 Fax: (318) 323-5053 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP/MySQL/XML
I have created a database called friends with four columns: Name / Address / City / State I also made an XML file to coincide with those variables: test contacts friends nameFriend 1/name address999 Foo Avenue/address cityFoo Town/city stateFO/state /friends /contacts /test The variables in the XML doc above are already in the database BUT - what I want to do - using PHP and MySQL - is something like this: $connection = mysql_connect(localhost, foo, bar) or die (Could not connect to server.); $db = mysql_select_db(friends) or die (Could not select database.); $sql = select * from friends order by name asc; $sql_result = mysql_query($sql, $connection) or die (Could not execute query.); echo ?xml version=\1.0\ encoding=\ISO-8859-1\?\n; echo ?xml-stylesheet type=\text/xsl\ href=\friends.xsl\?\n\n; echo test\n; echo \tcontacts\n; echo \t\tfriends\n; echo \t\t\tname; echo $name; echo \t\t\t/name\n; echo \t\t\taddress; echo $address; echo \t\t\t/address\n; echo \t\t\tcity; echo $city; echo \t\t\t/city\n echo \t\t\tstate; echo $home; echo \t\t\t/state\n; echo \t\t/friends; echo \t/contacts; echo /test; ? Can this be done and am I going about it the right way? Should you have any questions, comments or concerns, feel free to call me at 318-338-2034. Thank you for your time, Jay Fitzgerald, Design Director - CSBW-A, CPW-A, CWD-A, CEMS-A == Bayou Internet..(888) 30-BAYOUhttp://www.bayou.com Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net Vicksburg Online..(800) MISSISSIPPIhttp://www.vicksburg.com == Tel: (318) 338-2034ICQ: 38823829 Fax: (318) 323-5053 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] if variable is equal to 2 through 4
i am currently using this code: if ($variable == 2) || ($variable == 3) || ($variable == 4) { echo hello; } how would I write it if I wanted to say this: if $variable == 2 through 4 ??? Should you have any questions, comments or concerns, feel free to call me at 318-338-2034. Thank you for your time, Jay Fitzgerald, Design Director - CSBW-A, CPW-A, CWD-A, CEMS-A == Bayou Internet..(888) 30-BAYOUhttp://www.bayou.com Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net Vicksburg Online..(800) MISSISSIPPIhttp://www.vicksburg.com == Tel: (318) 338-2034ICQ: 38823829 Fax: (318) 323-5053 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] while...if statements???
Does anyone know why this isn't working?? What I am trying to do is display photos from a database based on each month. This part works fine when I set it to the current month of December (today) as that is when I uploaded the photos. However, when I manually set the date to a month that has no photos in it, I want it to echo the No Animals string belowThis is only working half-way...meaning that it will display a blank page with nothing on it instead of actually echoing the No Animals string Can anyone please help?? Is there really a way to have a while...if statement CODE= ? $connection = mysql_connect($hostname, $user, $pass) or die (Unable to connect!); $query = SELECT petname, petDesc, petpicture FROM petinfo WHERE petmonth = 'Apr'; $result = mysql_db_query($database, $query, $connection) or die (Error in query: $query. . mysql_error()); while (list($pet_name, $pet_Desc, $pet_picture) = mysql_fetch_row($result)) { if ($pet_picture == ) { echo No Animals have been posted for $date at this moment. Please check back soon.; exit; } else { echo FONT FACE=\Arial, Helvetica\BPet of the month/B/FONTBR BR IMG SRC=\http://moss.bayou.com:/oppj/admin/animalcontrol/photos/$pet_picture\; HEIGHT=150BR BR FONT FACE=\Arial, Helvetica\ SIZE=\-1\$pet_DescBR BR To adopt $pet_name please visit the Ouachita Parish Animal Shelter.BR The adoption fee is \$50.00 which includes Spade, Neutering and 7-N-1 Shot.BR BR Sorry, we can not hold $pet_name for you (First come first serve basis)./FONT BRBR; } } ? /CODE= Thanks, Confus3d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]