Jump to content

dsartain

Members
  • Posts

    68
  • Joined

  • Last visited

    Never

Everything posted by dsartain

  1. Ok, I've followed the directions to the T..I think.  I've modified the PHP.ini file to call for the extensions dir and php_mysql.dll...libmysql.dll is in the winnt directory (I'm running Win2K).  PHP runs by itself just fine.  MySQL runs by itself just fine.  Whenever I try to insert data in a DB via PHP, the web page comes up blank...it shouldn't do that...any ideas??
  2. Check to see if you have an '@ ' before your statements and such...PHP uses that to hide the output so designers can place custom errors there.  Hope this helps...if not, email me at dsartain18@yahoo.com and I'll see if I can figure anything out...
  3. Granted, I'm no expert at this yet, but what I would do is have a different table for each category.  I thought that I had a code xample but I don't...or can't find it anyway. Basic idea is this: Open a connection to the database, count the number of rows in each table (category) using different variables (obviously).  Then you can use a for loop to show each row (1, 2, 3) in the table.  When $var==$mysql_num_rows...not sure of syntax...then it will exit the loop and go onto the next table (category).  Hope this helps.  If you want me to take a look at what you've got I'd be more than willing to, email me at dsartain18@yahoo.com .  Later.
  4. phpinfo(); showed me the correct PATH, I move the libmysql.dll to C:\WINNT...I left the php_mysqli.dll file in C:\inetpub\wwwroot\php\ext...is that right??  I restarted IIS and nothing changed...I'm pasting my code to connect below in case that's an issue...I know PHP works because I can type info into a form, click submit, and then have it display on the next page, it's just the DB stuff that isn't working... [code] <?php // Declare variables from post // $firstname = addslashes($_POST['txtFirstName']); $lastname = addslashes($_POST['txtLastName']); $address = addslashes($_POST['txtAddress']); $apt = addslashes($_POST['txtApt']); $city = addslashes($_POST['txtCity']); $state = addslashes($_POST['drpState']); $zip = addslashes($_POST['txtZip']); $email = addslashes($_POST['txtEmail']); $phone1_type = addslashes($_POST['drpPhone']); $phone1 = addslashes($_POST['txtPhone']); $phone2_type = addslashes($_POST['drpPhone2']); $phone2 = addslashes($_POST['txtPhone2']); if ($_POST['stage'] === "insert") { $dbconn = mysql_connect("localhost","dsartain","marines"); mysql_select_db("test2",$dbconn); $query = "INSERT INTO `contacts` VALUES('$firstname','$lastname','$address','$apt','$city','$state','$zip','$email','$phone1_type','$phone1','$phone2_type','$phone2')"; $runquery = mysql_query($query,$dbconn); if (!$runquery) {echo "Query Failed"; } else { echo "Contact added!"; } } elseif ($_POST['stage'] === "verify") { //stripslashes!!!!! $firstname =stripslashes($firstname); $lastname = stripslashes($lastname); $address = stripslashes($address); $apt = stripslashes($apt); $city =stripslashes($city); $state = stripslashes($state); $zip = stripslashes($zip); $email = stripslashes($email); $phone1_type = stripslashes($phone1_type); $phone1 = stripslashes($phone1); $phone2_type = stripslashes($phone2_type); $phone2 = stripslashes($phone2); echo 'Name: ', $firstname.' ', $lastname.'<br /> '; echo 'Address: ', $address.'<br />'; if($apt != "") { echo 'Apt: ',$apt.'<br />'; } echo 'City: ', $city.'<br />'; echo 'State: ', $state.'<br />'; echo 'Zip: ', $zip.'<br />'; echo 'Email: ',$email.'<br />'; echo $phone1_type.' Phone: ',$phone1.'<br />'; if($phone2_type != " ") { echo $phone2_type.' Phone: ',$phone2.'<br />'; } ?> <p>Please verify the information you submitted.  If all information is correct press Submit</p> <p>If not press Edit to go back and correct the information</p> <form name="Form1" action="database.php" method="post"> <input type="hidden" value="<?=$firstname;?>" name="txtFirstName" /> <input type="hidden" value="<?=$lastname?>" name="txtLastName" /> <input type="hidden" value="<?=$address?>" name="txtAddress" /> <input type="hidden" value="<?=$apt?>" name="txtApt" /> <input type="hidden" value="<?=$city?>" name="txtCity" /> <input type="hidden" value="<?=$state?>" name="drpState" /> <input type="hidden" value="<?=$zip?>" name="txtZip" /> <input type="hidden" value="<?=$email?>" name="txtEmail" /> <input type="hidden" value="<?=$phone1_type?>" name="drpPhone" /> <input type="hidden" value="<?=$phone1?>" name="txtPhone" /> <input type="hidden" value="<?=$phone2_type?>" name="drpPhone2" /> <input type="hidden" value="<?=$phone2?>" name="txtPhone2" /> <input type="hidden" value="insert" name="stage" /> <input type="submit" value="Submit" /><input type="button" value="Edit" onCLick="history.back()"> </form> <? }?> [/code]
  5. I have my PHP.ini file as below ; Directory in which the loadable extensions (modules) reside. extension_dir = "C:\Inetpub\wwwroot\PHP\ext\" That should get it done right??  How do I check to make sure it's reading php.ini correctly??  I've tried restarting IIS and nothing changed.  Thanks 
  6. I've got PHP 5 installed on my Win2K machine running IIS. I've also installed MySQL...I downloaded the php_mysqli.dll and libmysql.dll files....I put them in the C:\Inetpub\wwwroot\PHP\ext folder....but for some reason PHP still won't talk to MySQL...I've got the extension_dir = "C:\Inetpub\wwwroot\PHP\ext\"  Any ideas anyone???
  7. I'm running IIS, but what's the difference between CGI and ISAPI??  I'm familiar with CGI scripts...but that's freakin ancient, and written in PERL/C...?
  8. Hey guys, I'm trying to use my Win 2k machine as a localhost...well, that part works, but I need to know how to configure it to run the latest version of PHP...know anywhere that explains how to do that in english??
  9. Ok, I'm making a page where someone can upload images to their website...user types in the path I.E. Images/folder1/newfolder and the image is uploaded...but it returns an error if the folder isn't there...I want it to create the folder instead...I would use FTP for this, but I'm going to be building the pic gallery with PHP and this upload page will also send info to a DB for the gallery page to pull from... [code] if(is_uploaded_file($this->userfile))     {            move_uploaded_file($this->userfile,$uploaddir2.$this->userfile_name);              } [/code] is what I'm using to move the file once the file is uploaded...any ideas?? Thanks
  10. [!--quoteo(post=356305:date=Mar 18 2006, 09:35 PM:name=keeB)--][div class=\'quotetop\']QUOTE(keeB @ Mar 18 2006, 09:35 PM) [snapback]356305[/snapback][/div][div class=\'quotemain\'][!--quotec--] Thanks for articulating that one better, hitman [/quote] Oh, ok....I had things set up right in my code on the page...just didn't type it right on here...woops..any thought on inline verses the other way???
  11. when you say don't initialize them in my class, but do so elsewhere...what do you mean? The only way I've ever learned classes in C++ or PHP is [code] class classname { private $variable; funciton setvariable($newvar){$this->variable=$newvar;} function getvariable(){return $this->variable;} }//end class [/code] granted the syntax is different in C++....but that's about it...how else should I initialize the variable???
  12. Hi guys, I'm relatively new to the PHP world, but I've taken several C++ courses so the syntax isn't that difficult. One of my friends who's helping me learn started griping because I did inline declarations (common in C++ from what I've been taught)... //variable declaration private $uploaddir; //INLINE DECLARATION: function setuploaddir(){$this->uploaddir=$_POST['upload_dir'];} //STANDARD DECLARATION: function setuploaddir() { $this->uploaddir=$_POST['upload_dir']; } Ok, to me it seems that since this is only doing one thing, inline should be fine and saves space, but I need to know what the experts think. How should I code this, or does it even matter...not when it comes to functionality, but as far as PHP standards go...? Thanks
  13. RESOLVED!!!!! Hey, I'm trying to use PHP to control font properties by having PHP pull info from a DB that someone submitted. They go to one page, fill out a form with the font face, color, and weight, submit that to the DB, then index.php pulls the info from the DB. I've used the echo to verify that the info is being pulled from the DB, and it is. I've gotten the face and color to work with: <font face=" <?php echo $font ?>" color= "<?php echo $color ?>" ><br /><?php echo $nicetext; ?><!--Whatever you want to put here!!!!!--></font> but I don't know how to do the weight...bold, italic, etc... Can anyone help with this???
  14. Yeah, the else statement was inside the while loop...how many years of coding and I missed that????? ah! Thanks
  15. I'm building a fairly standard registration form. I've got a couple of if statements to make sure that the username hasn't already been taken and the email address hasn't been registered already. The If and elseif statements work fine, but I get no output for the else statement at all. Please help me here, this is my last step to finish this. [code] $q="SELECT * FROM teresa_votes_test WHERE username='$username' OR email='$email'"; $res=mysql_query($q); $query = "INSERT INTO `teresa_votes_test`     VALUES('','$name','$username','$password','$email', '')"; while($row = mysql_fetch_array($res)) {     if($row['username']==$username)     {         echo $row['name']. " ". $row['username']. " ". $row['email']. " ".  "<br />";         $query_result = "That username has already been taken, please choose another <br />";     }     elseif($row['email']==$email)     {         echo $row['name']. " ". $row['username']. " ". $row['email']. " ".  "<br />";         $query_result = "You have already registered with us <br />";     }          else     {              $query_result ="Thanks for registering!";             /*             $runquery = mysql_query($query,$dbconn);             if (!$runquery) {echo "Query Failed"; } else {echo "Thank you for registering!";}             */     } } <body> <?php echo $query_result ?> </body>[/code]
  16. Hey, I've made a page that will process a form I posted on myspace, the page updates the DB fine, but I also want it to email me when it processes the form. How can I do this? PHP code below: <?php $name = addslashes($_POST['name']); $occupation = addslashes($_POST['occupation']); $myspace = addslashes($_POST['myspace']); $website = addslashes($_POST['website']); $dbconn = mysql_connect("localhost","dsartain","marines"); mysql_select_db("db_mysql",$dbconn); $query = "INSERT INTO `model_websites` VALUES('','$name','$occupation','$myspace','$website')"; $runquery = mysql_query($query,$dbconn); if (!$runquery) {$query_result= 'Query Failed'; } else {$query_result= 'Thank You For Your Submission!!!';} ?> I'm not displaying it so I haven't added the stripslashes yet... If you can help me with this please EMAIL me at dsartain18@yahoo.com for some reason I'm not getting emails when someone replies to my posts...fix that later....Thanks Don
  17. I am making a very, very basic page just to get things started and am trying to use the require() function to call the title page...just to get the syntax down....my main page is index.php as it calls heading.html (tried heading.inc as well) It will display the styles that are called in heading.html correctly...but not the styles in index.php...code as follows: [!--sizeo:4--][span style=\"font-size:14pt;line-height:100%\"][!--/sizeo--][b]index.php:[/b][!--sizec--][/span][!--/sizec--] <html><head> <title>Don's Website</title> </head> <?php require('PHP/includes/heading.html'); ?> <body class="body"> <table class="music1"> <tr>.......etc .......... </tr> </table> </body> </html> [!--sizeo:4--][span style=\"font-size:14pt;line-height:100%\"][!--/sizeo--][b]heading.html:[/b][!--sizec--][/span][!--/sizec--] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link href="../../Style Sheets/style.css" rel="stylesheet" type="text/css" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <div align="center" class="title"><img src="../../images/name2.gif" /></div> <p class="links" ><a href="index.html">Home</a> | <a href="music/index.html"> Music </a> | <a href="contact.aspx"> Contact </a></p> </body> </html> I also tried adding <link href="../Style Sheets/style.css" rel="stylesheet" type="text/css" /> to the index.php page but it still didn't work.... you can look at the very messed up version of my site at www.dsartain.com/index.php Any help would be much 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.