Search the Community
Showing results for tags 'tutorial'.
-
need php,ajax auto scroll pagination for the website www.unitedwebsoft.in .Current site is in PHP and also some section in Drupa CMS.
- 1 reply
-
- php
- pagination
-
(and 1 more)
Tagged with:
-
( ! ) SCREAM: Error suppression ignored for ( ! ) Warning: mysql_connect(): php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\wamp\www\widget_corp\includes\connection.php on line 4 Database connection failed: php_network_getaddresses: getaddrinfo failed: No such host is known. I am getting the error. I'm doing the PHP essential training course on Lynda.com. The teacher asked to make a constant.php file and then use constants to store the db user pass etc and then call it via the constant name or whatever and now i'm getting that huge error. I've been stuck for 2 days. Please help.
-
Warning: mysql_num_rows() expects parameter 1 to be resource
grifb posted a topic in PHP Coding Help
help!!! i have been trying things all day with this and it wont work! <html> <div align="center"> <?php $key = $_POST['key']; $answer = $_POST['answer']; $username = $_POST['username2']; $item = explode(" ", $key); $final = $item[0]; $removals = array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"); $lower = str_replace($removals, "", $final); $newkey = strtolower($lower); $areplace = str_replace("," , "', '", $answer); $buff = "['$areplace']"; $finalanswer = strtolower($buff); if ($key&&$username&&$answer) { $connect = mysql_connect("fakedatabase","fakeuser", "fakepassword") or die("Couldn't Connect"); mysql_select_db("wordlist") or die("No Table"); $query = mysql_query("SELECT * FROM keylist WHERE keys='$newkey'"); $numrows = mysql_num_rows($query); echo $numrows; if ($numrows!=0) { $queryadduser1 = mysql_query("INSERT INTO userkeys Values('$username', 'Tried : $newkey')") or die("Unable to connect"); die("The key '$newkey' has already been added!"); } else $queryadd = mysql_query("INSERT INTO keylist Values('$newkey')") or die("Unable to connect"); $queryadd2 = mysql_query("INSERT INTO KeysAndAnswers Values('$newkey', '$finalanswer')") or die("Unable to connect"); $queryadduser1 = mysql_query("INSERT INTO userkeys Values('$username', 'Added : $newkey ')") or die("Unable to connect"); echo("The key '$newkey' and the answer '$finalanswer' Has just been submitted! Thank you!"); } else die("Key or answer or username was blank"); ?> </div> </html> You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'keys='123-123'' at line 1 -
Hi All, Firstly I would like to thank you all for all of the help that you have give me thus far. I have no code to post <--- Reason I need to figure out how to first start. Which brings me to this. I am looking for an example or tutorial (Searched google with little luck) on how I can output a table in alphabetical order but on different pages. I seen a code a while ago that would help me out but lost it. Example of what I am trying to do is print out the menu A - Z Show All I already have a basic idea on how to do this but not sure how to do the show all. SELECT * FROM `cinvent` WHERE oname='$client' and iname like '$letter%' And also I am trying to clean it up some to only link the letters that actually have something in the database. Thank you for your time.
-
I looking for a good tutorial that will cover arrays, from HTML forms to storing the data( serialize,unserialize, implode, explode)in mysql with php I need to create a from that will allow me to create an array from text field then submit to database and late allow me to editied and update that array So I have four basic tables one serving as main table that will hold 5 field of data plus three field set aside for arrays then I have 3 tables that will hold keys and reference for those array plus additional data objective : In my main table the fields array1 array2 and array3 are the one I need to insert the array data into. I need to be able to manipulate the data of the array completely from an HTML form or multiple forms create basic HTML forms and PHP code to process I must be able to pull a record, check to see if that is an in those field array then add some data if their is if not start a new array for that record create basic HTML forms and PHP code to process I must be able to view and delete part of the array as well create basic HTML forms and PHP code to process then pull a record that has array data in it, then create a query base on those array to pull data from other tables and create some basic calculation base on the original record and the data that you reference in the other tables ( tables array1 array2 and array3 )create basic HTML forms and PHP code to process To help paint you better picture I am attaching below some sample tables and data I know that the data is not optimize but that is on purpose ok let say that this is( id) 2 in main 2 11 12 12 15 18 ('MOPQY4IV','9QR4TH7K','NZ1O45B0','1XUUU5D4','J94RVSNY')NULL NULL this array would be reference in table array1 'MOPQY4IV','9QR4TH7K','NZ1O45B0','1XUUU5D4','J94RVSNY' So in PHP I need to create a for loop that would take the value of this array and pull the data from table array1 I don't think the foreign key would work as this is not normalize database since other (id) in main could reference the same keys in array1 so I believe it be a many to many relation (id)3 could look some like this 3 10 16 12 17 14 ('MOPQY4IV','9QR4TH7K','JAM39TXN',)NULL NULL some of the array value are the same as in (id) 2 Thank You Antonio CREATE TABLE IF NOT EXISTS `array1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `arrayKey` varchar( NOT NULL, `data1` int(11) NOT NULL, `data2` int(11) NOT NULL, `data3` int(11) NOT NULL, `data4` int(11) NOT NULL, `data5` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=14 ; -- -- Dumping data for table `array1` -- INSERT INTO `array1` (`id`, `arrayKey`, `data1`, `data2`, `data3`, `data4`, `data5`) VALUES (1, 'MOPQY4IV', 0, 1, 0, 3, 2), (2, '9QR4TH7K', 2, 2, 0, 0, 2), (3, '8NBYRZ72', 2, 1, 3, 3, 3), (4, 'NZ1O45B0', 0, 2, 2, 3, 2), (5, 'Y7XPA7Q3', 0, 0, 1, 1, 2), (6, '1XUUU5D4', 1, 3, 2, 1, 2), (7, 'JVUI1KA6', 2, 1, 3, 3, 1), (8, 'J94RVSNY', 3, 2, 3, 1, 1), (9, 'NF9YSEF4', 2, 3, 0, 1, 3), (10, 'LFY81TBA', 1, 1, 1, 3, 1), (11, 'LZH9S2DE', 0, 3, 2, 0, 1), (12, '7XK4NF8M', 3, 1, 1, 2, 0), (13, 'JAM39TXN', 0, 0, 2, 2, 1); -- -------------------------------------------------------- -- -- Table structure for table `array2` -- CREATE TABLE IF NOT EXISTS `array2` ( `id` int(11) NOT NULL AUTO_INCREMENT, `arrayKey` varchar( NOT NULL, `data1` int(11) NOT NULL, `data2` int(11) NOT NULL, `data3` int(11) NOT NULL, `data4` int(11) NOT NULL, `data5` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=14 ; -- -- Dumping data for table `array2` -- INSERT INTO `array2` (`id`, `arrayKey`, `data1`, `data2`, `data3`, `data4`, `data5`) VALUES (1, 'BZGZX887', 1, 0, 0, 0, 3), (2, 'WW7JG2WI', 3, 1, 0, 2, 0), (3, 'U1UAK4Z7', 0, 2, 2, 3, 0), (4, 'L1ETC8VM', 1, 3, 3, 3, 3), (5, 'RYPO75Y6', 3, 3, 0, 1, 0), (6, 'O9XKS4B0', 2, 2, 2, 2, 0), (7, 'A1W8VD5M', 1, 1, 0, 3, 3), (8, '4EH4IUBF', 1, 3, 3, 2, 0), (9, '2YV7VJML', 0, 2, 0, 1, 1), (10, '1V9TPRT8', 1, 2, 3, 3, 1), (11, '6XC0QJPB', 1, 2, 2, 3, 3), (12, 'JWX4SG1M', 2, 2, 3, 1, 0), (13, '60UBRIB2', 0, 0, 2, 2, 0); -- -------------------------------------------------------- -- -- Table structure for table `array3` -- CREATE TABLE IF NOT EXISTS `array3` ( `id` int(11) NOT NULL AUTO_INCREMENT, `arrayKey` varchar( NOT NULL, `data1` int(11) NOT NULL, `data2` int(11) NOT NULL, `data3` int(11) NOT NULL, `data4` int(11) NOT NULL, `data5` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=14 ; -- -- Dumping data for table `array3` -- INSERT INTO `array3` (`id`, `arrayKey`, `data1`, `data2`, `data3`, `data4`, `data5`) VALUES (1, 'XW2R8FZV', 0, 2, 0, 2, 1), (2, 'U0UQ4XE0', 3, 3, 3, 2, 1), (3, 'DJZ0F72P', 0, 2, 0, 2, 1), (4, '58NZG2QT', 3, 0, 3, 1, 0), (5, '8X0MTA7C', 3, 3, 1, 3, 0), (6, '566JPHPO', 3, 1, 0, 2, 2), (7, '59FE3PVA', 3, 0, 2, 3, 1), (8, 'O87PI80J', 1, 2, 0, 3, 3), (9, 'J69OP30N', 1, 2, 0, 2, 2), (10, '4VCA5FA9', 2, 1, 1, 3, 3), (11, 'N6I82WQS', 2, 0, 3, 0, 2), (12, 'ZSNV3O7K', 0, 0, 2, 2, 3), (13, 'YE6E4RB0', 2, 2, 3, 1, 0); -- -------------------------------------------------------- -- -- Table structure for table `main` -- CREATE TABLE IF NOT EXISTS `main` ( `id` int(11) NOT NULL AUTO_INCREMENT, `data1` int(11) NOT NULL, `data2` int(11) NOT NULL, `data3` int(11) NOT NULL, `data4` int(11) NOT NULL, `data5` int(11) NOT NULL, `array1` text, `array2` text, `array3` text, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=17 ; -- -- Dumping data for table `main` -- INSERT INTO `main` (`id`, `data1`, `data2`, `data3`, `data4`, `data5`, `array1`, `array2`, `array3`) VALUES (1, 10, 11, 15, 14, 16, NULL, NULL, NULL), (2, 11, 12, 12, 15, 18, NULL, NULL, NULL), (3, 10, 16, 12, 17, 14, NULL, NULL, NULL), (4, 18, 10, 13, 16, 11, NULL, NULL, NULL), (5, 11, 10, 13, 9, 15, NULL, NULL, NULL), (6, 9, 18, 14, 17, 14, NULL, NULL, NULL), (7, 14, 18, 16, 13, 17, NULL, NULL, NULL), (8, 15, 16, 12, 17, 17, NULL, NULL, NULL), (9, 17, 16, 12, 14, 10, NULL, NULL, NULL), (10, 17, 14, 11, 9, 17, NULL, NULL, NULL), (11, 12, 18, 10, 13, 13, NULL, NULL, NULL), (12, 10, 12, 14, 14, 10, NULL, NULL, NULL), (13, 14, 14, 12, 17, 18, NULL, NULL, NULL), (14, 1, 1, 1, 1, 1, NULL, NULL, NULL), (15, 22, 22, 22, 22, 22, NULL, NULL, NULL), (16, 1, 1, 1, 1, 1, NULL, NULL, NULL);