370 Posted Topics
Re: The id in your table needs to be set to Auto Increment and that will then mean every time you add a new record that database will assign the next appropriate id for you to that record. With regard to selecting one record only <?php $id = // Assign the … | |
I thought I had this sorted on another website but just can't resolve the problem now. I have a link that when clicked shows a form. The form is submitted through jquery ajax, runs the PHP and updates the html in a div on success. All fine. However, after the … | |
Re: $_post is incorrect as always needs to be in upper case so change to $_POST ![]() | |
Re: What about trying your query like this (I have removed the NULL values as they are not required for your id column) if($_POST["Submit"]=="Submit"){ mysql_query("INSERT INTO tblUser VALUES ('$fname', '$lname')"); $new_id = mysql_insert_id(); for ($i=0; $i<sizeof($checkbox);$i++){ $sql2=mysql_query("INSERT INTO tblItems VALUES ('".$checkbox[$i]."', '$new_id')"); } } | |
Re: Works fine for me - are you sure you just have the navigation in your external file, like this? <div class='navi'> <ul class='item'> <li><a href=''>Birthday</a></li> <li><a href=''>New Baby</a></li> <li><a href=''>Anniversary</a></li> <li><a href=''>Wedding</a></li> <li><a href=''>Driving Test</a></li> <li><a href=''>Moving</a></li> <li><a href=''>New Job</a></li> <li><a href=''>Retirement</a></li> <li><a href=''>Good Luck</a></li> <li><a href=''>Engagement</a></li> </ul> </div> | |
This is driving me mad. I am using jquery and ajax to run the php to update my database and that all works fine, but after the update (specifically adding records) I want to re-run the query to get all records so that the new one is displayed but nothing … ![]() | |
Re: If I understand correctly what you are trying to do, why on earth do you have 2 separate databases for your albums and images rather than 2 tables in one database?? There are other errors in your code, firstly `$images[$i] = $row[0];` which will just keep populating your images array … ![]() | |
Re: Looks fine to me (Chrome on Mac). Have you thought it may just be the scrollbar making it appear this way? | |
Re: Your query is formatted incorrectly, it should be $sql="UPDATE `$tbl_name` SET `works` = `works` + 1 WHERE `id` = '".$id."'" or die(mysql_error()); | |
Re: Further to all the other error corections you have received above, to check one variable equals another you need to use == not just = so change: if ($newpassword == $confirmnewpassword) | |
Re: What exactly is the problem you are having (what errors etc) as WP comes with built in fuctions for adding images to posts or as featured images? | |
Re: I am very confused by your post and am thinking that what I am about to reply is incorrect as seems too simple, but here we go anyway just in case: SELECT * FROM table_name WHERE pos_id NOT IN (SELECT pos_id FROM position_table) | |
Re: When inserting records you don't need a value for the id so your query should just be $sql = "INSERT INTO content VALUES('$title', '$body')"; | |
Re: It is due to the fact that padding, borders and margins all add to the overall width of the div they are applied to (if you remove all these elements from your content div you will see what I mean). One solution is to add this to the top of … | |
Re: I really fee lfor you - sounds like a nightmare client. Is the site (or these pages) database driven or static html? | |
Re: As GliderPilot says - however, just to clarify as well, the error you are getting is telling you that $subcategory (in your query) is either empty or in an incorrect format. Where is the value assigend to $subcategory coming from (I don't see anything in your code where a value … | |
Re: Your code for the add to cart would help, but in general (this is an example) if your button has name="add_to_cart", you just need to check it that data is posted: if (isset($_POST['add_to_cart']) { // Do what you need to do here } | |
Re: To keep it really simple (unless I am missing something), you could just use SELECT * FROM trans_table WHERE from_id NOT IN (SELECT mem_id FROM position_table) | |
My brain is not functioning! I am trying to select a number of random images (lets say 3) from a selection of folders within one other folder and I am either over complicating the code or am missing something as I can't quite get it to work. What I have … | |
Re: Turn on error reporting as if you are getting a completely blank page then something is going wrong in either the code at the top of the page, or one of your include files. <?php session_start(); ini_set('display_errors',1); error_reporting(E_ALL); // rest of code here ?> | |
Re: I am not sure why you have so many stylesheets and inline style as well, but I think I have found your class for the widgets which has a right margin of 500px so it will always be pushed 500px from the right of the containing box as the page … | |
Re: I might be totally worng, but would you not need to check for both a and b separately SELECT * FROM t1 WHERE a NOT IN ( SELECT a FROM t1 WHERE c = 5 AND d = 6 ) AND b NOT IN ( SELECT b FROM t1 WHERE … | |
Re: Have you tried this to ensure you are getting the data passed through? print "<pre>"; print_r($_FILES); print "</pre>"; ![]() | |
Re: Try it like this $insert_sql = "INSERT INTO detail_paket (id_paket, menu_paket) select paket.id, %s from paket where paket.nama_paket='$nama_paket'"; $format_sql = sprintf($insert_sql, $data1[$i]); mysql_query($format_sql); | |
| |
Re: Unless you are assigning the $_POST['main_category'] to a variable called $main_category_p somewhere that we can't see, then you won't get anything echo'd out. You either need to assign the posted value to your new variable `$main_category_p = $_POST['main_category'];`or you should be using if($_POST['main_category'] == "Choose..."){ $_POST['main_category'] = ""; } echo … | |
Re: If you really want to use sub-queries, and presuming you want to show all posts by each user, then this is the sort of thing you will need (I don't know how you want to layout on the page or what your columns are named in your table so have … | |
![]() | |
Re: Change your Applications LI to this (and add a class to your parent ul): <ul class="vertical-menu"> . . <li><a href="#">Applicants</a> <ul class="submenu"> <li><a href="active-applicants.aspx">Active Applicants</a></li> <li><a href="inactive-applicants.aspx">Inactive Applicants</a></li> </ul> </li> . . </ul> And in your CSS (please change or add any additional required styling, this is the bare bones … | |
Re: Why on earth do you want to store someone's password in a session - no need and very insecure??? Regardless of this, your login is obviously working as you get redirected as per your code, but the username stored in the session is incorrect, nowhere in your script have you … ![]() | |
Re: Looking at what you have in the other preg_replace functions, shouldn't `#[^0-9#]i` actually be `#[^0-9]#i` With regard to your include files, that is down to you to check the paths to the files are correct I am afraid. As for the mysql_num_rows issue, your query will presumably not work until … | |
Re: You need to learn responsive design / development if you want your site to work on mobile. | |
Re: Just 'Google' it - there is so much information out there. | |
Re: Further to diafol's advice, in your current code, you have a lot wrong. This is what is should be (based on what you have already) - please compare this code to what you have to see your mistakes: <!-- <form action="ContactUs.php" method="POST"> this shouldn't be here --> <?php if (isset($_POST)) … | |
Re: It won't do anything as you have assigned the query to a variable that you are doing anything with so vchange it to if(isset($_POST['submit'])){ mysql_query("INSERT INTO arkentider (typ) VALUES('$_POST[typ]')") or die("Kunde inte lägga till ny räkning:<br />".mysql_error()); } // OR if(isset($_POST['submit'])){ $nypost = "INSERT INTO arkentider (typ) VALUES('$_POST[typ]')" or die("Kunde … | |
I am baffled, I have the following query which should return 4 records but for some reason it is counting 8 records and returning each row twice. I know I could use distinct, but as I also know that there are no duplicate records in this table I don't want … | |
Re: Please post the relevant sections of your stylesheet and html so we can help. | |
Re: If you `print_r($_POST);` you should see what is being passed to the next page and it will hopefully help you understand why your quesry isn't working (because you are assigning the whole of these arrays to your new array when you need to run them through a foreach): $whereClauses = … | |
Re: Please post what you have, not the tutorial, so we can see exactly what you are doing. | |
Re: Is your PHP really at the bottom of the page? If so, move it to the top before any html etc and add in an if statement to check if the form has been posted (i.e. `if (isset($_POST)) { ...... Do your DB stuff here ..... }` Does your table … | |
Re: If you really want to get the whole string after the ? you can use something like: $id = strstr($_SERVER['PATH_INFO'], '?'); $id = str_replace('?','',$id); | |
Re: You need to run your fetch_array through another while loop: while ($getthis = mysql_fetch_array($getsubject)) { echo "<option value=".$getthis['subjectID'].">".$test['subjectCode']."</option>"; } | |
Re: You want to be using foreach, not while to display your results from the form | |
Re: This doesn't do anything: <form action ="password generator" method="post"> It needs to be a proper file path, like: <form action ="password-generator.php" method="post"> | |
Re: This is wrong: <option value= '1' <?php echo $cat_row->country_id; ?> > It should be: <option value= "<?php echo $cat_row->country_id; ?>" > | |
Re: You have #Main in your CSS but `<div id="Mainpos">` in your HTML, your class and id names need to match what you have in your styelsheet, therefore it should be `<div id="Main">` | |
Re: It is just a warning that at the time your variables have no values. Try moving this $wages=$_POST['wages']; $hours=$_POST['hours']; Into your if statement if (isset($_POST['submit'])) { $wages=$_POST['wages']; $hours=$_POST['hours']; Also `print_r($_POST)` to check that you are receiving values through your form post. | |
Re: You can't run PHP in an .html file, it has to be a .php file ![]() | |
Re: if (isset($_GET['start'])) { $start=$_GET['start']; } Read [this article](http://www.simplyciousweb.com/web-development-tutorials/how-to-solve-php-notice-undefined-index/) to help further. |
The End.