Jump to content

Search the Community

Showing results for tags 'php mysql database'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. I'm successfully connecting to my database but cannot retrieve/pull data from my database. I'm using wamp. I figured I can echo any message I want but as soon as I enter the while loop and try to echo anything or in my case echo the rows from the database it simply does not work. I don't get any errors when running on wamp and I'm running out of ideas as of why this is happening. I'm using a form tag and extracting the users/people stored in the database with gender = "male/female", depending on which "radio/option" the user decides. Any help would be highly appreciated. <html> <head> <title>Enter title here</title> </head> <body> <?php if ($_GET) { $gender = $_GET[ 'gender']; $connect = mysql_connect("localhost", "root", "mypassword"); if ($connect) { mysql_select_db("ourDatabase", $connect); $query = "SELECT * FROM mytable WHERE Gender = ' " . $gender. " ' "; $result = mysql_query($query); while($row = mysql_fetch_array($result) ) { echo $row[ ' Name ' ] . "<br/>" . $row[ ' Surname ' ] . "<br/>" . $row[ ' Email ' ] ; } } else { die (mysql_error() ); } } ?> <form action="" method = "GET"> find entries that are: <br/> <input type= "radio" name = "gender" value = "Male">Male</input><br/> <input type = "radio" name = "gender" value = "Female">Female</input><br/> <input type ="submit" value = "Select"/> </form> </body> <html>
  2. Good day all. I am trying to achieve entering multiple email addresses to a mysql database field all at once. I wrote the following script to manage this but it's not working. I am seperating the emails with comma, but it only enters this (') into the database. I am trying to use implode function but I don't seem to be getting it right. Any help will be appreciated. Here is the code: <?php if(isset($_POST['submit'])){ $email = $_POST['email']; if(empty($email)) { echo '<p><font color="red"><strong>NO EMAIL ADDRESSES ENTERED</strong></font></p>'; $badinput = '<p><font color="red"><strong>PLEASE INPUT MEMBERS' EMAIL ADDRESSES</strong></font></p>'; echo $badinput; } else{ mysql_connect("somehost","someadmin","somepassword");//database connection mysql_select_db("somedatabase"); //inserting data order $allemails="('".implode("'), ('",$email)."')"; $membersemail = "INSERT INTO sometable (email) VALUES ('$allemails')"; //declare in the order variable $result = mysql_query($membersemail); //$membersemail executes } if($result){ echo '<center><font color="red"><h1>SUCCESS!!!</h1></font></center>'; echo '<center><h3>DATABASE POPULATED WITH MEMBERS' EMAIL ADDRESSES</h3></center>'; } } ?> <form name= "someform" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <center><table border="0" cellspacing="10"> <tbody> <tr> <td align="right"><span class="style5">Members' E-mail Addresses:</span> </td> <td><label for="email"></label> <textarea name="email" id="email" cols="45" rows="10"></textarea> </td> </tr> </tbody></table> <input type="submit" name="submit" value="Submit"> <input type="reset" name="reset" value="Reset"></center> </form> What am I doing wrong? Thanks all.
×
×
  • 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.