Jump to content

bugzy

Members
  • Posts

    272
  • Joined

  • Last visited

Everything posted by bugzy

  1. I have this code as my session_init.php <?php $_SESSION['APP_MX'] = "mail.mywebsite.com"; $_SESSION['APP_SERVER'] = "mywebsite.com"; $_SESSION['SITE_EMAIL'] = "admin@mywebsite.com"; $_SESSION['MYSQL_SERVER1'] = "localhost"; $_SESSION['MYSQL_LOGIN1'] = "root"; $_SESSION['MYSQL_PASS1'] = "password"; $_SESSION['MYSQL_DB1'] = "sample"; $_SESSION['LOGGEDIN'] = ""; $_SESSION['USERID'] = 0; $_SESSION['EMAIL'] = ""; $_SESSION['FNAME'] = ""; $_SESSION['LNAME'] = ""; $_SESSION['SESSION'] = true; ?> and I'm calling it here <?php if(!isset($_SESSION['SESSION'])) require('../email/session_init.php'); $fname = $_POST["fname"]; $lname = $_POST["lname"]; $email= $_POST["email"]; $company = $_POST["company"]; $subject = $_POST["subject"]; $phone = $_POST["phone"]; $msg = $_POST["msg"]; $mail = "Hello $fname,\n\nThank your for your email.\nWe look forward to your evaluation of our product.\n\n"; $mail .= "Here is the information you have given us:\n\n"; $mail .= "Name: ".$fname." ".$lname."\n"; $mail .= "Company: ".$company."\n"; $mail .= "Email Address: ".$email."\n"; $mail .= "Phone: ".$phone."\n\n"; $mail .= "Subject: ".$subject."\n"; $mail .= "Your Message:\n".$msg."\n\n\n"; $mail .= "Best Regards,\nCustomer Service\n\n"; // If any lines are larger than 70 characters, we will use wordwrap() $message = wordwrap($msg, 70); mail($email, $subject, $mail, "From: admin@".$_SESSION['APP_SERVER']."\r\n"); $mail = str_replace("\n", "<br>", $mail); ?> And I'm getting this error I wonder if there's any modification that I need to do in my php.ini file. Anyone?
  2. Hey I already solved it the problem is on <td><? echo $player_id; ?></td> <td><? echo $fname; ?></td> <td><? echo $lname; ?></td> <td><? echo $team; ?></td> <td><? echo $email; ?></td> so I make it Just a question, I thought PHP is accepting this? <? //open ?> //close I wonder why the rows didn't show up by just using that....
  3. Hello! I have this code <?php include_once('../database_connection.php'); $thiskeyword = addslashes($_REQUEST['keyword']); $sqlquery = "Select * from nba_info where player_id like '%$thiskeyword' OR fname like '%$thiskeyword' OR lname like '%$thiskeyword' OR team like '%$thiskeyword' OR email like '%$thiskeyword'"; $result = MYSQL_QUERY($sqlquery); $numberOfRows = MYSQL_NUM_ROWS($result); ?> <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Search Result</title> </head> <body><center><br /><br /> <?php if($numberOfRows==0) { die('You keywords haven\'t much any data from the database'); } else if($numberOfRows>0) { echo $numberOfRows. " Results have been found!"; $i = 0; ?> <table> <tr> <td>player_id</td> <td>fname</td> <td>lname</td> <td>team</td> <td>email</td> </tr> <?php while($i<$numberOfRows) { $player_id = MYSQL_RESULT($result,$i,"player_id"); $fname = MYSQL_RESULT($result,$i,"fname"); $lname = MYSQL_RESULT($result,$i,"lname"); $team = MYSQL_RESULT($result,$i,"team"); $email = MYSQL_RESULT($result,$i,"email"); ?> <tr> <td><? echo $player_id; ?></td> <td><? echo $fname; ?></td> <td><? echo $lname; ?></td> <td><? echo $team; ?></td> <td><? echo $email; ?></td> </tr> <?php $i++; } ?> </table> <?php } ?> <ul> <li><a href="/php/database/ManipulatingDatabase/add_database.php">Add New Player</a></li> <li><a href="/php/database/ManipulatingDatabase/edit_form.php">Edit Player</li> <li><a href="/php/database/ManipulatingDatabase/delete_form.php">Delete Player</li> <li><a href="/php/database/ManipulatingDatabase/search_form.php">Search Player</li> <li><a href="/php/database/ManipulatingDatabase/manipulate_database.php">BACK TO MAIN</a></li> </ul> </center> </body> </html> I have no problem with the sql statement as code echo $numberOfRows. " Results have been found!"; is giving me a numbers of rows. The problem is the rows that have been found is not showing up in the html row. I wonder what the problem is.. anyone?
  4. Thanks Drummin This is exactly what I did and it solved the issue Thanks again!
  5. Huh? I don't know what you're talking about. I'm new in php and this is not a project that I'm doing. I'm just practicing base on a sample code from a tutorial video and I encountered this issue and I can't find the solution on it. From an expert like you, I thought the code that you have given would detect why I'm having this issue
  6. Hey thanks here <?php include_once('../database_connection.php'); $player_id = addslashes($_REQUEST['edit_player']); $sql_query = "Select * from nba_info where player_id = '$player_id'"; $result = MYSQL_QUERY($sql_query); $numberOfRows = MYSQL_NUM_ROWS($result); while($row = mysql_fetch_array($result)) { $row['player_id']; $row['fname']; $row['lname']; $row['team']; $row['email']; } $id = $row['player_id']; $fname = $row['fname']; $fname = $row['lname']; $lname = $row['team']; $email = $row['email']; ?> <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>This Is Where we Edit the Data!</title> </head> <body><center><br /><br /> <?php if($numberOfRows==0) { die('There\'s no Player with that player ID number'); } ?> <table> <form name="edit_player_form" method="post" action=""> <tr> <td>Players ID</td> <td><input type="text" name="playerid" size="20" value="<?php echo $id; ?>" /></td> </tr> <tr> <td>First Name</td> <td><input type="text" name="fname" size="20" value="<?php echo $fname; ?>" /></td> </tr> <tr> <td>Last Name</td> <td><input type="text" name="lname" size="20" value="<?php echo $lname; ?>" /></td> </tr> <tr> <td>Team</td> <td><input type="text" name="team" size="20" value="<?php echo $team; ?>" /></td> </tr> <tr> <td>Email</td> <td><input type="text" name="email" size="20" value="<?php echo $email; ?>" /></td> </tr> <tr> <td><div align="center"> <input type="submit" name="Submit" value="Edit This Player"> </div></td> </tr> </form> </table> <center> </body> </html>
  7. I have a table that has 5 columns I'm trying to get all the values from that table using this sql command include_once('../database_connection.php'); $player_id = addslashes($_REQUEST['edit_player']); $sql_query = "Select * from nba_info where player_id = '$player_id'"; $result = MYSQL_QUERY($sql_query); "edit_player" above is came from a different page. They I'm fetching the data using while while($row = mysql_fetch_array($result)) { $row['player_id']; $row['fname']; $row['lname']; $row['team']; $row['email']; } Then I'm trying to pass that values to a variable here $id = $row['player_id']; $fname = $row['fname']; $fname = $row['lname']; $lname = $row['team']; $email = $row['email']; When I'm trying to put that variables in a textbox value, they are not showing up Here <table> <form name="edit_player_form" method="post" action=""> <tr> <td>Players ID</td> <td><input type="text" name="playerid" size="20" value="<?php echo $id; ?>" /></td> </tr> <tr> <td>First Name</td> <td><input type="text" name="fname" size="20" value="<?php echo $fname; ?>" /></td> </tr> <tr> <td>Last Name</td> <td><input type="text" name="lname" size="20" value="<?php echo $lname; ?>" /></td> </tr> <tr> <td>Team</td> <td><input type="text" name="team" size="20" value="<?php echo $team; ?>" /></td> </tr> <tr> <td>Email</td> <td><input type="text" name="email" size="20" value="<?php echo $email; ?>" /></td> </tr> <tr> <td><div align="center"> <input type="submit" name="Submit" value="Edit This Player"> </div></td> </tr> </form> </table> I wonder why it ain't showing up on the textbox value? tried almost everything... Anyone?
  8. Solved. Sorry for my ignorance as I'm very new in PHP Thanks again!
  9. I have this connection file "database_connection.php" under folder C:\wamp\www\php\database\database_connection.php and I'm calling it using required_once on file "add_database.php" under folder C:\wamp\www\php\database\ManipulatingDatabase\add_database.php Here's the code on <?php include_once('../database/database_connection.php'); ?> and I'm having this error I have tried everything else. Maybe there's something wrong on my .ini file?Anyone?
  10. I do have some follow up questions regarding sproc that's why I created this thread.. Oh well.. thanks for the link though.
  11. Hello I'm just a beginner.. I just want to ask if MySql also have Stored Procedure like MS Sql? Anyone..?
  12. I already solved it guys. Error is on my 3rd parameter. I misspelled the variable. Thanks for those who help me!
  13. Maq I'm not sure if I got what you're talking about.. But it's already there... notice the $password variable?
  14. Here <?php $user = "user1"; $password = "password1"; $connect = mysql_connect('localhost',$user,$passord) or die("Cannot connect to the database! :". mysql_error()); echo "We connected successfuly to the Database!"; echo "<br/><br/>"; ?> What do you think?
  15. Hello! I'm just a beginner. I'm now practicing on connecting to a database here on my local machine but I'm having this error. I'm using MySql 5.1.36 and phpMyAdmin 3.2.0.1 TIA! Any idea what seemed to be the problem?
  16. Thanks you very much to litebearer and AbraCadaver Problem Solved! Great forum and I'm learning here. Thanks again!
  17. Hello I've registered here last March and I'm just lurking around reading threads about php. Yesterday I've started to self studied php and today I've test some basic codes and I'm having difficulties on creating a table rows and columns. Here's my code. <?php echo "<table width=\"100\" border=\"1\">"; $text = 'php'; $mac_var = 1; $mac_plus = 4; while ($mac_var < $mac_plus) { echo "<tr>"; { while ($mac_var < $mac_plus) { echo "<td>". $text . "</td>"; $mac_var++; } } echo "</tr>"; $mac_var++; } echo "</table>"; ?> what I want is, it should have 3 columns and 3 rows. But I'm getting only 3 columns and 1 row only. I wonder what is the problem? Sorry for my ignorance as I'm on the 1st basic phase of using php codes. TIA!
×
×
  • 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.