PHP - Php And Mysql Front Question
hello , could anyone please point me on how can i read the data i input from an html page to appear on the mysql front server.
ive print screen my problem this is the signup page ,where i input the user name and password here's the signup page html code """<html> <head> </head> <body> <h1>Personal Info</h1> <form name="form" method="post" action="SignUp.php"> <p>UserName:<input type="text" name="usrn" /></p> <p>Password:<input type="password" name="pass" /></p> <p><input type="submit" value="Sign Up"/> <input type="submit" value="Clear" /></p> </form> </body> </html> """"" and this is the mysqlserver ,where i want the username and password i entered to show here's the php code i wrote """"<?php $usr=$_POST["usrn"]; $pass=$_POST["pass"]; $db=mysql_connect("localhost","root",""); mysql_select_db("realestate",$db); $q="insert into Customer Values('$usr','$pass')"; mysql_query($q); mysql_close(); ?>""""" i would really appreciate any help from you guys. Thank you. Similar TutorialsThis topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=330652.0 This for loop: for ($m = 01; $m <= 12; $m++) Will output: 1 2 3 4 etc. And NOT: 01 02 03 04 My question is: how can I make the number be 2 digits and have it output together with the ZERO? And when it's reaching the number 10 it should continue outputting: 10 11 12 And not 010 011 etc. What does it mean Like.. !@file_get_contents('url'); or.. !file_get_contents or @file_get_contents This is driving me nuts and I'm hoping someone can help me figure it out. I have a site with PHP/MySQL. I have a form where people can submit a comment. This comment then goes into a MySQL database and gets displayed back on another page of the website. NOTE: I put this question in the PHP Forum because I think the problem is happening somewhere BEFORE the info gets entered into MySQL. But of course, I could be wrong. The problem is that some of the comments are coming in with a "\" in front of apostropes, but NOT ALL OF THEM (which is really confusing me). For example, someone entered this comment which shows in the MySQL database exactly like this... I predict Lena's gonna win a lifetime Grammy. It's long overdue. Someone else entered a comment which shows in the MySQL database exactly like this... can\\\'t wait to see first pics of the next addition. Congrats! They both have apostrophes in them, but only that second one added those slashes (and 3 of them for some reason). There are more instances of this where some comments have the slashes before the apostrophe and some don't. Anyone know what might be causing this seemingly random insertion of slashes? Front end web developer and a application developer?
is one better than the other?
also is getting a 1 year certificate in one of the above with lots of experience in relation to designing and coding land someone a job in this field?
Is a degree nessesary right now? in order to get a job in one one of these fields or can one do that part time wile working but holding a certificate in one of these fields with freelance experience
Is there a way to trim everything off in front of the last backslash in the string? Code: [Select] $trimFile = $fList[$i]; Example: In this path: \\\\myftp/downloads/tom/work/word_docs\\legal\test.pdf I only want to display test.pdf. Thanks, Jake Code: [Select] <?php if(isset($_SERVER['PHP_AUTH_USER'])) { echo "<a href='schedule.php'>Request A Skype Session</a>"; } ?> works great for someone that islogged in my htpasswd, however, I would like to hide Code: [Select] <a href="/members/index.php">Login</a> if they are logged in, how do i go about doing the opposite of the first code i linked...sorry if it sounds complicated Hi, I am trying to get my contact form from page into header. I have been at his for days now, I can get the contact form into the header with this <?php echo do_shortcode( '[contact-form 1 "Contact form 1"]' ); ?> but can not get it to sit centrally and in front of image.
This is my site, http://www.cloudchasing.co.uk/
The site style that I am trying to emulate is this one http://www.premierwi...screens.co.uk/
Pleeeease help a newcomer
How can i do the sum of two numbers inside of a mysql quory, or if this is possible? Code: [Select] while($rand = mysql_fetch_array($cerereSQL)) { $pctsteaua = $rand['puncte']; echo "<pre>"; print_r ($rand); echo "</pre>"; } First i have this variable $pctsteaua who will return me a number. This number i need to use it here. Code: [Select] mysql_query ("UPDATE liga1 SET puncte='$pctsteua + 3', m='1', v='1' WHERE echipa='Steaua' "); The problem is, how i do the math inside this myslq quory to work properly and update my database not with a submited number, but with the sum between the $pctsteaua variable + 3. What will make the database take longer to load and pull data from it A database with lots of tables or a database with very few tables but a shit load of data in each table? Thanks for your reply Hi, wye does $link return a empty row in mysql? Code: [Select] $link = $m[1]; $ssql = "INSERT INTO site (id, link) VALUES ('', '$link');"; mysql_query($ssql); thanks, Guys: What is the way to remove white spaces in front of a form entry ? Should I use regular expression for this ? Thanks. This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=325383.0 Sample array: array('one','two','three','_zero'); How could I sort this array so that _zero moves to the front.. Any items that begin with an underscore should be moved to the front of the array to get something like so: _zero, one, two, three Thanks Hey everyone. [= I don't have much time to read through all of the forums, because I'm on a time crunch and I'll be putting this certain project behind a couple others while I wait for some answers. This project is confusing me a bit, because I haven't worked much with arrays and the good ol' checkbox, so I need some help getting this to work. This project requires me to set-up a checkbox next to each order that was pulled off a database. You are allowed to select as many checkboxes as you'd like, and then click on the "process receipts" for all of the orders that were selected. I need to be able to have the form send me straight to a new page that pulls a loop of receipts one after another. I have the receipts built, and I can access a receipt one at a time based off the ID of a certain order, and I can easily build a loop that presents the receipts. I'm just having a problem pulling the information off the database based from the checkbox array. If you can give me some ideas on where to start with this, I'd greatly appreciate it. Note: Example is inside a hidden administrative page. Can't really give you something to play with, sorry! QQ Thanks! Alex D.A. Designing Hi, I have an array that I've set up as a JSON feed API. The array pulls data from a MySQL query, one of the fields in the query ('description') contains text with escape characters. I'm just wondering how I change either the query to remove the escape characters (ie can you strip escape chars in MYSQL?) - or change the array to strip the escape chars?? Code: [Select] //Run query $result = mysql_query(' SELECT DATE_FORMAT(gl_date,"%d-%m-%Y")as "date", gl_venue as "venue", gl_city as "city", gl_postcode as "postcode", gl_text as "description", concat(DAYOFMONTH(gl_date), MONTHNAME(gl_date),".png") AS "imageName" FROM tg_gig_list where gl_date >= curdate() and gl_publish = 1 order by gl_date '); $array = array(); $array['gigs'] = array(); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $array['gigs'][] = $row; } $output = json_encode($array); } Hey Everyone, I was hoping someone out there could help me figure something out. I am trying to create a ticket database, when I create a ticket, I give the option to upload a file, which works ok. But I am stumped at trying to display mulitply files to one ticket. If I have a ticket no 0001 and two files associted to 0001, i end up printing two 0001 tickets each with a single file. I want to print one 0001 with both files listed under it. I'm not sure if it's possible to do a while within a while so I hoping someone can help me figure that out. Thanks for your help PHP Code: <HTML><BODY><table align="center" width="600"><tr><td> <?php include 'connect.php'; // how many rows to show per page $rowsPerPage = 3; // by default we show first page $pageNum = 1; // if $_GET['page'] defined, use it as page number if(isset($_GET['page'])) { $pageNum = $_GET['page']; } // counting the offset $offset = ($pageNum - 1) * $rowsPerPage; $query = " SELECT tickets.ticketno, tickets.tickettitle, tickets.customer, tickets.status, tickets.dateresolved, tickets.datecreated, tickets.description, files.name, files.content FROM tickets LEFT JOIN files ON tickets.ticketno=files.ticketno ORDER BY ticketno LIMIT $offset, $rowsPerPage"; $result = mysql_query($query) or die('Error, query failed'); while($row = mysql_fetch_array($result)) { echo "<table align='center'><tr><td colspan='2'><img src='images\line_v9.gif'></td></tr>"; echo "<tr><td> <b>Ticket No -- " . $row['ticketno'] . "</b></td><td> Ticket Title -- " . $row['tickettitle'] . "</td></tr>"; echo "<tr><td> Customer -- " . $row['customer'] . "</td><td> Description -- " . $row['status'] . "</td></tr>"; echo "<tr><td> Date Resolved -- " . $row['dateresolved'] . "</td><td> Date Created -- ". $row['datecreated'] ."</td></tr>"; echo "<tr><td colspan='2'> Description -- " . $row['description'] . "</td></tr>"; echo "<tr><td colspan='2'> </td></tr><tr><td colspan='2'> <b>Reference Documents</b> </td></tr>"; echo "<tr><td> File -- " . $row['name'] . "</td><td> <a href='http://www.dbitpro.com/csp/files/" . $row['name'] . "'>Download Here</a></td></tr></table>"; } $query = " SELECT files.*, tickets.* FROM files,tickets WHERE tickets.ticketno=files.ticketno"; $result = mysql_query($query) or die('Error, query failed'); while($row = mysql_fetch_array($result)) { echo "<table><tr><td> File -- " . $row['name'] . "</td><td> Ticketno" . $row['ticketno'] . "</td></tr></table>"; } // how many rows we have in database $query = "SELECT COUNT(ticketno) AS numrows FROM tickets"; $result = mysql_query($query) or die('Error, query failed'); $row = mysql_fetch_array($result, MYSQL_ASSOC); $numrows = $row['numrows']; // how many pages we have when using paging? $maxPage = ceil($numrows/$rowsPerPage); // print the link to access each page $self = $_SERVER['PHP_SELF']; // creating previous and next link // plus the link to go straight to // the first and last page if ($pageNum > 1) { $page = $pageNum - 1; $prev = " <a href=\"$self?page=$page\">[Prev]</a> "; $first = " <a href=\"$self?page=1\">[First Page]</a> "; } else { $prev = ' '; // we're on page one, don't print previous link $first = ' '; // nor the first page link } if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href=\"$self?page=$page\">[Next]</a> "; $last = " <a href=\"$self?page=$maxPage\">[Last Page]</a> "; } else { $next = ' '; // we're on the last page, don't print next link $last = ' '; // nor the last page link } // print the navigation link echo $first . $prev . " Showing page $pageNum of $maxPage pages " . $next . $last; // and close the database connection mysql_close($con) ?> </td></tr></table> </BODY></HTML> been wondering about this for a while do I need to put the escape on each WHERE? or do i really only need to put it on the $_POST i can probably understand why i need it on $_GET also after WHERE. So wondering about the session id. Code: [Select] <?php mysql_query("UPDATE systems SET homes= $homes + '".mysql_real_escape_string($_POST['homes'])."' WHERE address = '".mysql_real_escape_string($_GET['planet'])."' AND id = '".($_SESSION['user_id'])."'"); ?> Hey all. mysql_real_escape_string() seems to be working fine for me, but I'm wondering why the entries in the database don't reflect my SQL query. For example, here is the string php is sending to MYSQL: Code: [Select] insert into bands (bandname, hometown, website, creation, bio, addedon) values ('band', '\'gaewg\"f gswogsw<?php OR \'\'=\' rswaiohgri ', '', '1992', '\' OR \'\'=\'', '10182010') This has already been run through mysql_real_escape_string(), but when I go to phpmyadmin here is what I see: Code: [Select] `bands` (`id`, `bandname`, `creation`, `photo`, `bio`, `hometown`, `website`, `addedon`) VALUES (34, 'band', '1992', '', ''' OR ''''=''', '''gaewg"f gswogsw<?php OR ''''='' rswaiohgri ', '', '10182010'); My question is does it matter if it's not slashed in the database? Might be just a newbie here but isn't that how injection works? Anyhow, just let me know wise phpfreaks users. Thanks in advance. Well, basically I am making my log in script. This is my first website with php and MySQL... actually, its my first website I have done that isn't for a school project. Anywho, the problem I am having is I can't seem to verify the password of the account I am trying to log into. Here is the code snippet I am having trouble with: $usr = $_REQUEST['Username']; $pass = $_REQUEST['Password']; $pass = md5($pass); if(mysql_query('SELECT Password FROM Accounts WHERE Username = "' .$usr . '"') == $pass) { session_start(); $_SESSION['loggedin'] = yes; $_SESSION['User'] = $usr; $_POST['info'] = ("You have successfully logged in " . $usr . "."); } else { $_POST['info'] = "Username and password do not match.";} The problem is that it doesn't seem to matter if the username and password are correct, it always prints "Username and password do not match.". So, here is the table layout of 'Accounts': Did I type the mysql query wrong? |