Jump to content

Search the Community

Showing results for tags 'php mysql'.

  • 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

  1. Can any body help me here? All I want to do is a simple drill down. From the mysql supplied 'world' database I have a PHP program that creates a table with country codes ,names etc. I want t be able to select one record and use it's country code to go to another .php program that lists all the citys from the 'city' table supplied by Mysql for that country. It is a short task for VB.net but I am having problems with it in PHP Mysql
  2. I am getting error "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a6743732/public_html/sign_up.php on line 46" and "Query was empty". Code is: <?php include('config.php'); ?> <!DOCTYPE html> <html> <meta name="viewport" content="width=device-width"> <link rel="stylesheet" type="text/css" href="style.css"> <head> <title>PokeVille</title> </head> <body> <div id="header"> <center><img src="http://s13.postimage.org/citvl9c9f/Poke_Ville_Index_Sprite.png" alt="PokeVille Logo" width="240" height="100"></center> <center><a href="sign_up.php">Register</a> | <a href="connexion.php">Login</a></center> </div> <br> <?php //We check if the form has been sent if(isset($_POST['username'], $_POST['password'], $_POST['passverif'], $_POST['email'], $_POST['avatar']) and $_POST['username']!='') { //We remove slashes depending on the configuration if(get_magic_quotes_gpc()) { $_POST['username'] = stripslashes($_POST['username']); $_POST['password'] = stripslashes($_POST['password']); $_POST['passverif'] = stripslashes($_POST['passverif']); $_POST['email'] = stripslashes($_POST['email']); $_POST['avatar'] = stripslashes($_POST['avatar']); } //We check if the two passwords are identical if($_POST['password']==$_POST['passverif']) { //We check if the password has 6 or more characters if(strlen($_POST['password'])>=6) { //We check if the email form is valid if(preg_match('#^(([a-z0-9!\#$%&\\\'*+/=?^_`{|}~-]+\.?)*[a-z0-9!\#$%&\\\'*+/=?^_`{|}~-]+)@(([a-z0-9-_]+\.?)*[a-z0-9-_]+)\.[a-z]{2,}$#i',$_POST['email'])) { //We protect the variables $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); $email = mysql_real_escape_string($_POST['email']); $avatar = mysql_real_escape_string($_POST['avatar']); //We check if there is no other user using the same username $dn = mysql_num_rows(mysql_query('select id from users where username="'.$username.'"')); $ret = mysql_query($query) or die(mysql_error()); if($dn==0) { //We count the number of users to give an ID to this one $dn2 = mysql_num_rows(mysql_query('select id from users')); $id = $dn2+1; //We save the informations to the databse if(mysql_query('insert into users(id, username, password, email, avatar, signup_date) values ('.$id.', "'.$username.'", "'.$password.'", "'.$email.'", "'.$avatar.'", "'.time().'")')) { //We dont display the form $form = false; ?> <div class="message">You have successfuly been signed up. You can log in.<br /> <a href="connexion.php">Log in</a></div> <?php } else { //Otherwise, we say that an error occured $form = true; $message = 'An error occurred while signing up.'; } } else { //Otherwise, we say the username is not available $form = true; $message = 'The username you want to use is not available, please choose another one.'; } } else { //Otherwise, we say the email is not valid $form = true; $message = 'The email you entered is not valid.'; } } else { //Otherwise, we say the password is too short $form = true; $message = 'Your password must contain at least 6 characters.'; } } else { //Otherwise, we say the passwords are not identical $form = true; $message = 'The passwords you entered are not identical.'; } } else { $form = true; } if($form) { //We display a message if necessary if(isset($message)) { echo '<div class="message">'.$message.'</div>'; } //We display the form ?> <div class="content"> <form action="sign_up.php" method="post"> Please fill the following form to sign up:<br /> <div class="center"> <label for="username">Username</label><input type="text" name="username" value="<?php if(isset($_POST['username'])){echo htmlentities($_POST['username'], ENT_QUOTES, 'UTF-8');} ?>" /><br /> <label for="password">Password<span class="small">(6 characters min.)</span></label><input type="password" name="password" /><br /> <label for="passverif">Password<span class="small">(verification)</span></label><input type="password" name="passverif" /><br /> <label for="email">Email</label><input type="text" name="email" value="<?php if(isset($_POST['email'])){echo htmlentities($_POST['email'], ENT_QUOTES, 'UTF-8');} ?>" /><br /> <label for="avatar">Avatar<span class="small">(optional)</span></label><input type="text" name="avatar" value="<?php if(isset($_POST['avatar'])){echo htmlentities($_POST['avatar'], ENT_QUOTES, 'UTF-8');} ?>" /><br /> <input type="submit" value="Sign up" /> </div> </form> </div> <?php } ?> <div class="foot"><a href="<?php echo $url_home; ?>">Go Home</a> - <a href="http://www.webestools.com/">Webestools</a></div> </body> </html>
  3. Hi all, Here is my existing code for inserting a new entry into a MySQL table. What I would like to do is be abel to add the 'ccategory' from a URL parameter - such as www.mysite.com/add_image.php?cat=3 . Can you help me edit my code below to make this work. Thanks, Mike --------------------------------------------------------------- <?php // connect database $dbc = mysql_connect("localhost", "###", "###"); // select database mysql_select_db("artbyiyu_art", $dbc); if(isset($_POST)) { //echo $_POST['name']; $fileName = $_POST['name']; $time = time(); mysql_query("INSERT INTO uploadify3(filename, filedate, category) VALUES('$fileName', '$time', '$category')"); $inserted_id = mysql_insert_id($dbc); if($inserted_id > 0) { // if success echo "uploaded file: " . $fileName; } } ?>
  4. hey all, i have a tricky problem that i can't get my head around. i have a msql table that will populate a drop down menu, this is fine. I have another table that has a column that contains a number that i want to use to tell how many times the drop down menu should appear. for example. beach house has a drop down number of 8 (8 possible locations to place an option) - so when i display my php page showing this row (using GET) it shows 8 drop down menus from the table drop down menu (all menus are the same) eg. MENU: Window Sliding Door Entry Door i'm totally lost on how to get the 8 from the beach house row to relate to the number of drop down menus.
  5. Hi, i am wanting to create a simple page with two buttons on, one that says 'start visit', one that says 'end visit', thats the simple bit, here's what i would like the form to do When 'Start Visit' is clicked i would like it to place an entry in the following db: I would like it to add the value "start visit" into the value field, automatically insert todays date into the date field and autonatically insert the time (GMT) into the time field. i have made general form before but have no idea on where to start....... any help would be appreciated
  6. Hello, I'm trying to concatenate a number split in 3 different text boxes and then compare it against the id value stored in the database and store in a variable so that the corresponding id number can be used in an insert statement, but i don't where i seem to go wrong.If any one could help me with this, it would be really helpful. Thanks. aggr_nr = $_REQUEST['list_nr_01'].$_REQUEST['list_nr_02'].$_REQUEST['list_nr_03']; $sql="SELECT v.id FROM vers_einl_aggregatenumber AS v WHERE v.aggr_nr = '".$aggr_nr."'";//missing Quotes $aggr_id = @mysql_query($sql); $result = @mysql_fetch_array($aggr_id); $test= $_get[$result['id']];
  7. I have a file with a little over one million rows and would like to put it in a mysql database. But I am not sure of the best and easyist way. MY Table: create table dbo.PUBACC_EN ( record_type char(2) not null, unique_system_identifier numeric(9,0) not null, uls_file_number char(14) null, ebf_number varchar(30) null, call_sign char(10) null, entity_type char(2) null, licensee_id char(9) null, entity_name varchar(200) null, first_name varchar(20) null, mi char(1) null, last_name varchar(20) null, suffix char(3) null, phone char(10) null, fax char(10) null, email varchar(50) null, street_address varchar(60) null, city varchar(20) null, state char(2) null, zip_code char(9) null, po_box varchar(20) null, attention_line varchar(35) null, sgin char(3) null, frn char(10) null, applicant_type_code char(1) null, applicant_type_other char(40) null, status_code char(1) null, status_date datetime null I attached a file with sample data. data.txt
  8. I'm in a quandry. I have a series of records in a table. I'm allowing NULLs on my varchar columns, because the imported data may not have values for some of them. I need to manipulate each record with the end-goal of creating another query which will be used to insert data into another table. The first table, with the NULLS permitted, is the one I'm currently traversing with a 'while loop': $sql = "select * from " . DB_TBL; $result = mysql_query($sql); while ($data = mysql_fetch_assoc($result)) { //my foreach loop goes here } Pretty straightforward so far. So, I thought, was my foreach loop: foreach ($data as $key => $value) { if ((strlen($value) != 0)) { echo "key: " . $key . ': =' . $value . '<br />'; } else { echo '<br />'; } } When I run that, I seem to lose the first column, which is never NULL or strlen=0. It just doesn't display. Should this be done another way? Perhaps getting the numrows first, then doing the foreach, incrementing the row inside a for/next loop? thanks in advance for any productive ideas.
  9. hi i need your help guys please help me i want to display random pages from folder ok let me explain more there is news page and at the end of every news page i want to display related or random news to that page and i want to do this with database because via database only it is possible but for me its so confusing and its so easy for some guys here first i want to create thumbnail of every image related to page (manually) 125x125 then i want it to store in database with width and height and alt then as for page i.e title of page,page name etc with auto increment ID of this table and after this i want to display the image and page title in 150x150 div (but image and page must be from same ID) i will b very very thankful to u guys please help me
  10. Hi.. everyone! I've noticed that Facebook, Twitter, and lots of other sites are using a relative date and time string description for user posts and comments. For example, "comment written about 3 months ago" instead of "comment written on September 20, 2012." I decided to do the same thing on my site. In my site I need to display 1 day ago, 2 days ago, 3 days ago,...... 1 week ago, 2 weeks ago, .... 1 months ago, 2 months ago, ...... 1 year ago, 2 years ago... etc. Already I have got user registered date and need to check it with current date and time and need to diplay it with above style on my home page. In my database, user registered date format is like this .. '2012-09-23 09:11:02' can anybody help me to build this script... and it will greatly appriciated. Thank you.
  11. Hi all, Im looking for some help with a page views counter in php. suppose when user viewing a profile page and spend minimun 10 seconds time on that page then i have to calculate view as 1... so how to do that?? I have stored all profile details in a database and all pulled through the same template page, like profile.php?id=12345. can anybody give me sample example Thank you..
  12. I have a standard form that displays users current data from a mysql database once logged in(code obtained from the internet). Users can then edit their data then submit it to page called editform.php that does the update. All works well except that the page does not display the updated info. Users have to first logout and login again to see the updated info. even refreshing the page does not show the new info. Please tell me where the problem is as i am new to php. my form page test.php <?PHP require_once("./include/membersite_config.php"); if(!$fgmembersite->CheckLogin()) { $fgmembersite->RedirectToURL("login.php"); exit; } ?> <form action="editform.php?id_user=<?= $fgmembersite->UserId() ?>" method="POST"> <input type="hidden" name="id_user" value="<?= $fgmembersite->UserId() ?>"><br> Name:<br> <input type="text" name="name" size="40" value="<?= $fgmembersite->UserFullName() ?>"><br><br> Email:<br> <input type="text" name="email" size="40" value="<?= $fgmembersite->UserEmail() ?> "><br><br> Address:<br> <input type="text" name="address" size="40" value="<?= $fgmembersite->UserAddress() ?> "><br><br> <button>Submit</button> my editform.php <?php $con = mysqli_connect("localhost","root","user","pass"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } mysqli_query($con,"UPDATE fgusers3 SET name = '".$_POST['name']."', email= '".$_POST['email']."', address= '".$_POST['address']."' WHERE id_user='".$_POST['id_user']."'"); header("Location: test.php"); ?>
×
×
  • 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.