
joshstevens19
Members-
Posts
30 -
Joined
-
Last visited
Everything posted by joshstevens19
-
My query wont insert into a single coloum in my phpmyadmin?
joshstevens19 replied to joshstevens19's topic in PHP Coding Help
okay that did help me mix my code up but now im getting this error?? error inserting new recordUnknown column 'TEST' in 'field list' this happens when i enter information and press enter? -
My query wont insert into a single coloum in my phpmyadmin?
joshstevens19 replied to joshstevens19's topic in PHP Coding Help
it not covered as i didnt get the answer i wanted? -
My query wont insert into a single coloum in my phpmyadmin?
joshstevens19 replied to joshstevens19's topic in PHP Coding Help
oh sorry i posted in wrong code that code works perfectly: have a look at this one please if (isset($_POST['submitted'])) { $name = $_POST['entername']; $usernameorguest =$_POST['usernameorguest']; $reply =$_POST['reply']; $sqlinsert = "UPDATE `forumposts`(`REPLY`) VALUES('$reply') WHERE `POSTID`=1"; $query = mysql_query($sqlinsert); if (!$query) { echo "error inserting new record" . mysql_error(); } } // end of mani if statment //$newrecord ="1 record added to the database"; my table is defined all correctly not posted the connection code as i didnt think that was relevant -
My query wont insert into a single coloum in my phpmyadmin?
joshstevens19 replied to joshstevens19's topic in PHP Coding Help
oh sorry i posted in wrong code that code works perfectly: have a look at this one please if (isset($_POST['submitted'])) { $name = $_POST['entername']; $usernameorguest =$_POST['usernameorguest']; $reply =$_POST['reply']; $sqlinsert = "UPDATE `forumposts`(`REPLY`) VALUES('$reply') WHERE `POSTID`=1"; $query = mysql_query($sqlinsert); if (!$query) { echo "error inserting new record" . mysql_error(); } } // end of mani if statment //$newrecord ="1 record added to the database"; ?> i know i have missed a couple of vaiables out but i am just testing it to make sure it works first? any ideas -
hey guys rite i have created a website and i am trying to insert a indivual piece of data into 1 column of my phpmyadmin page table. But i am doing a TV show website and just creating a easy and basic forumn.. i am trying to insert a reply code which when you enter the details in the reply box and sumit it insert it into ID number 1 of column reply.. at the moment all it does it insert it into the end of another ID which it is creating automatically can anyone help me .. i have attached my table on to this message so you can see what the table is like!! here is my code? <?php if (isset($_POST['submitted'])) { $posttopic = $_POST['POSTTOPIC']; $postdeatils =$_POST['POSTDEATILS']; $postauthor=$_POST['POSTAUTHOR']; $sqlinsert = "INSERT INTO forumposts (`POSTTOPIC`, `POSTDEATILS`, `POSTAUTHOR`) VALUES('$posttopic', '$postdeatils', '$postauthor')"; $query = mysql_query($sqlinsert); if (!$query) { echo "error inserting new record" . mysql_error(); } } // end of mani if statment //$newrecord ="1 record added to the database"; ?>
-
using query does not insert into the phpmyadmin table?
joshstevens19 replied to joshstevens19's topic in PHP Coding Help
okay thanks will do -
using query does not insert into the phpmyadmin table?
joshstevens19 replied to joshstevens19's topic in PHP Coding Help
i have done and it brings up this error ? error inserting new recordYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(`REPLY`) VALUES('pdijspdjf') WHERE `POSTID`=1' at line 1 -
using query does not insert into the phpmyadmin table?
joshstevens19 replied to joshstevens19's topic in PHP Coding Help
it is a column that already exsists in my phpmyadmin table.. it is empty and this code should post it in to that column.. i change it to INSERT and it comes up with this error message error inserting new recordYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO `forumposts`(`REPLY`) VALUES('test') WHERE `POSTID`=1' at line 1 saying the code is incorrect.. when i have ran it without the insert of POSTID it insert but not on the one i want it to it creates a new ID as that is on ai and posts it in that section?? any ideas?? thanks josh -
using query does not insert into the phpmyadmin table?
joshstevens19 replied to joshstevens19's topic in PHP Coding Help
<?php if (isset($_POST['submitted'])) { $name = $_POST['entername']; $usernameorguest =$_POST['usernameorguest']; $reply =$_POST['reply']; $sqlinsert = "INSERT INTO `forumposts`(`REPLY`) VALUES('$reply') WHERE `POSTID`=1"; $query = mysql_query($sqlinsert); if (!$query) { echo "error inserting new record" . mysql_error(); } } // end of mani if statment //$newrecord ="1 record added to the database"; ?> this is my code now -
using query does not insert into the phpmyadmin table?
joshstevens19 replied to joshstevens19's topic in PHP Coding Help
sorry guys i knew i wrote it wrong.. okay i have replaced the code and now it comes up with this error? error inserting new recordYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `POSTID`=1' at line 1 what does this mean?? just want to insert the data in my valables into the result column in ID1 ? i dont understand why it will not work? thanks a lot josh -
using query does not insert into the phpmyadmin table?
joshstevens19 replied to joshstevens19's topic in PHP Coding Help
sorry guys i knew i wrote it wrong.. okay i have replaced the code and now it comes up with this error? error inserting new recordYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `POSTID`=1' at line 1 what does this mean?? just want to insert the data in my valables into the result column in ID1 ? i dont understand why it will not work? thanks a lot josh -
using query does not insert into the phpmyadmin table?
joshstevens19 replied to joshstevens19's topic in PHP Coding Help
i know i have undefined variables at the moment just trying to get it to insert into the correct box -
hey guys rite i have created a website and i am trying to insert a indivual piece of data into 1 column of my phpmyadmin page table. But i am doing a TV show website and just creating a easy and basic forumn.. i am trying to insert a reply code which when you press reply it insert it into ID number 1 of column reply.. at the moment all it does it insert it into the end of another ID which it is creating can anyone help me here is my code? <?php if (isset($_POST['submitted'])) { $name = $_POST['entername']; $usernameorguest =$_POST['usernameorguest']; $reply =$_POST['reply']; $sqlinsert = "INSERT INTO `forumposts` WHERE (`POSTID`=1) INTO (`REPLY`) VALUES('$reply')"; $query = mysql_query($sqlinsert); if (!$query) { echo "error inserting new record" . mysql_error(); } } // end of mani if statment //$newrecord ="1 record added to the database"; ?>
-
PHP coding help .. ? query and if statements playing up
joshstevens19 replied to joshstevens19's topic in PHP Coding Help
BOOM fixed thanks man!!!! you superstar -
PHP coding help .. ? query and if statements playing up
joshstevens19 replied to joshstevens19's topic in PHP Coding Help
yes the bracket is done on it.. okay i understand a little bit mac but i still dont have a clue how to fix it as soon as i can fix this im laughing! lolll sorry i sound so dumb -
PHP coding help .. ? query and if statements playing up
joshstevens19 replied to joshstevens19's topic in PHP Coding Help
no errors at all.. only thing i get is 'error inserting new record' which as you can see is my If statments output if (!mysql_query($sqlinsert)) { die('error inserting new record'); so i may be rite by saying the code is doing it but it will only ever die because thats the only way it can go.. there is no else clauise or anything the if statment is saying even if successful Die?? am i correct? -
PHP coding help .. ? query and if statements playing up
joshstevens19 replied to joshstevens19's topic in PHP Coding Help
the database form has information it .. it is a review page.. all i want it to do is when someone rites in the field it inserts into the database.. simple as that.. i dont know why it is doing it when there is information in the database and all im asking of it is to just place it in the slots i have i issued within the code i.e SHOWTITLE ETC.. ??? -
PHP coding help .. ? query and if statements playing up
joshstevens19 replied to joshstevens19's topic in PHP Coding Help
okay so here is my code: <?php if (isset($_POST['submitted'])) { include('connect database.php'); $showtitle = $_POST['SHOWTITLE']; $showreview =$_POST['SHOWREVIEW']; $sqlinsert =mysql_query ("INSERT INTO `reviews` (SHOWTITLE,SHOWREVIEW) VALUES('$showtitle', '$showreview'"); if (!mysql_query($sqlinsert)) { die('error inserting new record'); } what changes would you make to it ?? im very terrible at this lol !!.. the names on the database on SHOWTITLE and SHOWREVIEW -
what the dollar signs are making it not work :S and in the if statement do i need a result factor as at the moment it only says die if you look at my code!
-
PHP coding help .. ? query and if statements playing up
joshstevens19 replied to joshstevens19's topic in PHP Coding Help
do you think it could be this?? if (isset($_POST['submitted'])) { include('connect database.php'); $showtitle = $_POST['SHOWTITLE']; $showreview =$_POST['SHOWREVIEW']; $sqlinsert =mysql_query ("INSERT INTO `reviews` (SHOWTITLE,SHOWREVIEW) VALUES(['$showtitle'], ['$showreview']"); if (!mysql_query($sqlinsert)) { die('error inserting new record'); at the bottom it says the if statment but it only says die not if it works etc??? do i need a result key or anything to finilise it -
PHP coding help .. ? query and if statements playing up
joshstevens19 replied to joshstevens19's topic in PHP Coding Help
yes they are.. thats what they are called .. not sounding cheeky but could you write a code for inserting into a database with my fields or something to help me out and i try that? .. i just dont get what i am doing wrong (((((((((((((( thanks a lot for your help -
PHP coding help .. ? query and if statements playing up
joshstevens19 replied to joshstevens19's topic in PHP Coding Help
im new to php can you expand... i have changed to mysql_error()); all i want to do is get it to insert and it is not working can you look at my code and suggest a way round it? -
PHP coding help .. ? query and if statements playing up
joshstevens19 replied to joshstevens19's topic in PHP Coding Help
<?php if (isset($_POST['submitted'])) { include('connect database.php'); $showtitle = $_POST['SHOWTITLE']; $showreview =$_POST['SHOWREVIEW']; $sqlinsert =mysql_query ("INSERT INTO reviews (SHOWTITLE,SHOWREVIEW) VALUES('$showtitle', '$showreview'"); if (!mysql_query($sqlinsert, $dbConn)) { die('error inserting new record</b>'. mysql_error); } thats is my code for the insert statment... now the query is in that.. here what it brings up Notice: Use of undefined constant mysql_error - assumed 'mysql_error' in C:\xampp\htdocs\PhpProject1\New Review.php on line 28 error inserting new recordmysql_error line 27 is die('error inserting new record</b>'. mysql_error); now what am i doing wrong.. my SQL code maybe that is wrong but their is something in this code which wont allow it to work... pleasee help me guys haaa i have been dying with this code for ages if you know can you put it in my code for me so i dont get confused like a example etc? thanks for your help -
PHP coding help .. ? query and if statements playing up
joshstevens19 replied to joshstevens19's topic in PHP Coding Help
when i echo it out it comes up with this Warning: mysql_query() expects parameter 1 to be string, resource given in C:\xampp\htdocs\PhpProject1\New Review.php on line 27 error inserting new record and when i switch them about all it says is 'error inserting new record' but no warning codes.. whats the next thing i could do as it not inserting it into the database which i am trying to achieve