Jump to content

Search the Community

Showing results for tags 'mysql'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Calendars

  • Community Calendar

Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 246 results

  1. Hello folks, I want to hide a text inside a image(users given image using file upload). Thanks in advance
  2. Read Multiple Rows Sequentially

    QUESTION ONE: What is it called when you traverse an entire table in equal multiples of records? (I ask this question, because I have been fraught with frustration in my google searches.) QUESTION TWO: Do you know a routine that I can copy and modify? (This would greatly simply my search.) BACKGROUND: Surely there must be a standard routine for performing the following procedure: 1) Use PHP to read and display the first ten records of a MySQL table. 2) Read and display the next ten records of the same data table. 3) Either return to the previously read ten records and display these or continue on to the following ten unread records and display them. 5) When you have reached the end of the table display only the remaining records. GOAL: Ultimately I would like to read and display 10 records in a list format. At the bottom of the list I would place two buttons. One that displays the previously 10 records and one that displays the next ten unread records. WHAT I HAVE ACHIEVED SO FAR: <?php $col_name = 'item_pubdate'; $result_obj = $mysqli_obj->query("SELECT * FROM rss2_podcast_item ORDER BY '$col_name' LIMIT 0, 10"); while($row=$result_obj->fetch_array()) { ?> <div class='table_row podcast_item'> <div class='flex_item num_div'><?php echo $row['podcast_no_item'] . '&nbsp'; ?></div> <div class='flex_item date_div'><?php echo $row['item_pubdate']; ?></div> <div class='flex_item title_div'><?php echo $row['item_title']; ?></div> </div><!-- end div.table_row --> <div class='table_row discover_div'> <div class='flex-item'>Discover more ...</div> </div><!-- end div.table_row --> <div class='table_row'> <div class='flex-item details_div'> <?php echo $row['item_description']; ?> </div><!-- end div.table_row --> </div><!-- end div.table_row --> <?php } ?> With a little additional CSS and Javascript I have been able to achieve the following display. Clicking on the phrase "Discover more ..." reveals the hidden detail obtained from $row['item_description]. No. Publication Date|Time Podcast Title 60 2017-06-19 17:26:41 Title Ten Discover more ... 59 2017-06-18 09:50:37 Title Nine Discover more ... . . . 51 2017-09-24 11:00:17 Title One Discover more ... DESIRE: If I can only achieve the above stated goal, I can likely figure out a way to get AJAX to allow users to select podcast items by the week, month, year, and later category. But, this is already much too far into the future. For the moment, I would simply like to achieve my above stated goal. Any ideas? Roddy
  3. $text = "i am a student of oxford university, and i love to tell everyone how much i have enjoyed my four years in school. the whole environment was really welcoming" . Actually, we have a database table called "text_word". So, i want a script that will search through the above text and check if any of those words from the above text does not exist in the "text_word" table, such word should be replaced by asterisks and store the replaced word into a separate column called "unmatched_word" in the same "text_word" table. let's assume the word "welcoming" was not existing in my database what i want to achieve is this. the text is parsed through the program INPUT: "i am a student of oxford university, and i love to tell everyone how much i have enjoyed my four years in school. the whole environment was really welcoming" . OUTPUT: "i am a student of oxford university, and i love to tell everyone how much i have enjoyed my four years in school. the whole environment was really ******" . Code Sample: foreach ($text as $word) { $select_word = $f->filterRecord("*", "parts_of_speech", "word", $word); $get_word = $f->show_data($select_word); $count_words = $f->numR($select_word); if ($count_words > 0) { $result[] = '<a href="word/?w='.$word.'">'.$word.'</a>'; } else { $result[] = "******"; } } Please i believe the code is not doing exactly what i want. If you have a better approach to how i can get the job done, i don't mind if you give me a fresh code snippet or script. I hope you understand what i'm trying to do now?
  4. Unwanted Row Entry Duplication

    QUESTION ONE: How does one suppress duplicate row entries? QUESTION TWO: In the following case what is causing them to occur? BACKGROUND: I created several tables only to discover that they were not as I wanted them. AFter truncateng each, I dropped what I believed to be poorly structured columns, rearranged some, and added still others. When I tested the result, everything worked great except for one problem -- a single table entry reuslted in duplicate rows. THE TABLE STRUCTURE CREATE TABLE 'table_name' (obs` int(5) NOT NULL AUTO_INCREMENT . . . PRIMARY KEY (`obs`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 A SAMPLE SQL STATEMENT INSERT INTO rss2_podcast_itunes (podcast_no_itunes, itunes_category1, itunes_category2, itunes_category3, itunes_complete, itunes_new_feed_url, itunes_name, itunes_email, itunes_duration, itunes_order, itunes_author, itunes_block, itunes_image, itunes_explicit, itunes_summary) VALUES ('54', 'education', 'language', 'English', '', '', 'Roddy A. Stegemann', 'kiusau@me.com', '00:01:01', '', 'Roddy A. Stegemann', '', 'http://www.grammarcaptive.com/_images/captive.png', '', 'Test') Please note the following: No value is entered for the obs field/column. The auto increment advances one for each row entered. Below each successfully loaded row entry appears another row identical in every way but one -- the appearance of an incremental advance in the value of the obs field. Please advise. Roddy
  5. 1) I have login scripts working in combination with database table and verify_password 2) the login scripts are RE-USED for another site 3) In the test fase I use the SAME database table values and copy these in phpmyadmin to a new table is it possible there is some kind of copy security or whatever in the encrypted original table values? I presume this because there is no password_verify match. It could be I'm overlooking something, but the password_verify($form_pw, $database_pw) procedure, does not need encryption BEFORE $form_pw is read? The only conclusion then is: the value in the newly copied table is not the same is in the original table. (of course I can also reinstall the registration scripts to test it, but i would like to rule out other causes ) EDIT: solved. silly me using the wrong password
  6. Hey guys, I have a problem. I want to write a record in my db when it does not already exists. For this, i have been looking on the web and found multiple solutions on Stackoverflow. The one I use is proved working, by the stack user however I get my die response :(. I use the following query (mysql/php): $query= "IF NOT EXISTS (SELECT * FROM tasksmade WHERE teamnumber='$teamnumber' AND tasknumber='$tasknumber' AND date='$date') INSERT INTO tasksmade (teamnumber, tasknumber, taskfinished, date) VALUES ('$teamnumber', '$tasknumber', '$taskfinished', '$date')"; $result= mysql_query($query,$mysql) or die("The query result has failed on the db!"); Hope someone can help! Thanks!
  7. mysql join from 2 different databases

    Hi all, I have a question about join or inner join; not sure in what way it should be used. I now use 2 queries in 2 different databases (made in phpmyadmin). SELECT `title` FROM `writers` WHERE id ='qwert58efedd1979f'; SELECT `name`, `lastname`, `str`, `nr`,` place` FROM `client` WHERE id ='qwert58efedd1979f'; I would like to make one mysql query and use join to search in 2 tables in 2 different databases. Can anyone tell how mysql does this?
  8. Xampp is not working

    Hello folks, I installed a XAMPP Version 7.0.15 on my windows 7(32-bit) computer but it doesn't work properly.When i open in the browser it shows "The site can't be reached". What's the solution for it? please help me. Thank you in Advance..
  9. Copy table from sql to mdb

    Hi, i'm new and i hope not wrong with to ask the following question: i see this instruction SELECT * INTO CustomersBackup2013 IN 'Backup.mdb' FROM Customers; in thee site, that is in a section of copy from sql (to mdb, i thougt since the db name is backup.mdb). I'm looking for the similar command for copy/create the similar command but for mysql as origin and mdb as destination. Thanks of all.
  10. wordpress, mybbs, wiki.

    is there a way to make a singular login for a wordpress website that also logs a person into the forums and the wiki at the same time?
  11. connecting to msqli

    Looking at how form items are put into a mysql table, the part that seems daunting is if ones form has like 50 items... having to list all those IDs with their variables makes me wonder if there is a better way or if its just " it up buttercup.".
  12. So my question is: how can I insert variables into my mysql queries in php? This is my code now, I would like to use the $me and the $friend variables to work in the sql query: function newChat($me, $friend) { global $conn; $sql = "SELECT id FROM chats WHERE (person1 = $me AND person2 = $friend) OR (person1 = $friend AND person2 = $me);"; mysqli_query($conn, $sql) or die('Error querying database.'); echo "check <br />"; $result = mysqli_query($conn, $sql); $row = mysqli_fetch_array($result); while ($row = mysqli_fetch_array($result)) { echo $row['id'] . ' - ' . $row['person1'] . ' - ' . $row['person2'] . ' - ' . $row['date'] .'<br />'; } } newChat('John', 'Marie'); Also if I set $sql to "SELECT * FROM chats" it only gives me one row of my two test rowes in my database. (it only gives the second row, and just ignores the first one? --> a screenshot of the database is at the end of this post) Can anyone please help me with this? Thanks already!
  13. updating column with increment in mysql

    In phpmyadmin I did the following query and had it output in php like this: $sql = "UPDATE `table` SET count = count + 1 WHERE unique_nr = 5175781"; this all worked well. though when I tried to implement it in my script I had an error: script: <?php // code to establish dbase connection: var_dump($unique_nr); // $stmt = $conn->prepare('UPDATE table SET count = ? WHERE unique_nr = ? '); $stmt = $conn->prepare('UPDATE table SET count = count + 1 WHERE unique_nr = ? '); $stmt->bind_param("is", $count, $unique_nr); $stmt->execute(); ?> resulting in an error message. I also tried this way of writing for bind_param: $stmt->bind_param("s", $unique_nr); but that didnt update the column, though there wasnt an error message anymore
  14. MySQL query is not working

    MySQL queries are not working only inside this block: ... if (isset($_POST['send'])) { } ... The variable itself is set and transferred from the form. What could be the reasons of this and how is better to check?
  15. InnoDB for Image Gallery Tables

    Dear all, For photo gallery tables (named: gallery_album, gallery_image, gallery_relation), I have seen a recommendation to use InnoDB engine in preference to MyISAM. I thought MyISAM would be the choice for all tables but tables for transactions. Do you agree with the recommendation to using InnoDB for photo gallery tables and why?
  16. Index vs Key

    Dear all, I am trying to dig into the exact difference between key and index in MySQL tables. Some say they are synonymous, others give some differences. I still don't feel confident enough to decide when to use each on a table. I would appreciate if someone well-versed in their difference explain such difference and when to use each. Thanks.
  17. Different Image Size

    Hi all, I have uploaded an image to a folder/directory and stored its size using the $_FILES['image']['size'] superglobal. While the image source size was reading 153kb, the stored size is 157317. Why there is a difference in size?
  18. Why Do We Store tmp_name of a File?

    Dear all. For an image uploaded to a folder/directory and stored its name, type, and size in a DB table, what could be the merits of also storing its temporary name, noting that such temporary name is deleted by the server upon moving the image to the desired folder/directory?
  19. Unknown Printed Charector

    Hi all, In fetching a result from a table (below code), 1 is also printed after the fetched record (fetched record below). There is no 1 in the table, nor have I accidentally included it in my script. What is it and why does it appear? <?php require 'db/connect.php'; if($result = $db->query("SELECT * FROM user")) { if ($count = $result->num_rows) { $rows = $result->fetch_assoc(); echo '<pre>', print_r($rows), '</pre>'; } } ?> Array ( [id] => 1 [first_name] => Bill [last_name] => John [bio] => I'm a web developer [created] => 2016-11-21 12:50:12 ) 1
  20. Lack of Error Reporting

    Hi all, <?php require 'db/connect.php'; $result = $db->query("SELECT * FROM people"); ?> I obtained a blank page running the above script, which indicates that everything is fine (path and table name are correct). I then removed the * from the query to see if it would report an error, but it did not. I added print_r($result); and run it. Nothing has changed. I included the * and run, it reported the number of rows and columns in the table. Why there has a been a lack of error reporting in this instance, noting that the ini file is configured to report all sorts of errors, even the warnings and notices (and it is reporting all that in other scripts)?
  21. Hi all, In one website, I read the following note: "You should also think about storing files locations on disk. Using MySQL for storing images is thought to be Bad Idea™. Handling SQL table with big data like images can be problematic." Do you agree? If not, why? What is the best practice in storing and displaying on a website a big number of images?
  22. I'm trying to select data from a MySQL database that is hosted on a webserver. I want to be able to retrieve the data from a table within the database and then illustrate it within a HTML table. There's an example on W3Schools that I've been following, but I'm unable to retrieve the data successfully. http://www.w3schools.com/php/php_ajax_database.asp Below is the source code: (HTML) <html> <head> //Javascript code <script> function showUser(str) { if (str == "") { document.getElementById("txtHint").innerHTML = ""; return; } else { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("txtHint").innerHTML = this.responseText; } }; xmlhttp.open("GET","getuser.php?q="+str,true); xmlhttp.send(); } } </script> </head> <body> <form> <select name="users" onchange="showUser(this.value)"> <option value="">Select a person:</option> <option value="1">Peter Griffin</option> <option value="2">Lois Griffin</option> <option value="3">Joseph Swanson</option> <option value="4">Glenn Quagmire</option> </select> PHP File: (getuser.phd) <!DOCTYPE html> <html> <head> <style> table { width: 100%; border-collapse: collapse; } table, td, th { border: 1px solid black; padding: 5px; } th {text-align: left;} </style> </head> <body> <?php $q = intval($_GET['q']); $con = mysqli_connect('www.example.com','user_Admin','12345-678','my_DB'); if (!$con) { die('Could not connect: ' . mysqli_error($con)); } mysqli_select_db($con,"ajax_demo"); $sql="SELECT * FROM user WHERE id = '".$q."'"; $result = mysqli_query($con,$sql); echo "<table> <tr> <th>Firstname</th> <th>Lastname</th> <th>Age</th> <th>Hometown</th> <th>Job</th> </tr>"; while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['FirstName'] . "</td>"; echo "<td>" . $row['LastName'] . "</td>"; echo "<td>" . $row['Age'] . "</td>"; echo "<td>" . $row['Hometown'] . "</td>"; echo "<td>" . $row['Job'] . "</td>"; echo "</tr>"; } echo "</table>"; mysqli_close($con); ?> </body> </html> *MySQL table is attached I think the issue might exist from mysqli_select_db($con,"ajax_demo"); onwards inside the PHP file. Should I be referring to the table that contains the data inside the database? I have the PHP File hosted on my webserver, so I'm not sure why it won't retrieve that data when a person is selected from the list of options on the HTML page. Any help would be much appreciated.
  23. utf8 VS utf8mb4

    Dear all, I came across the following statement on one website: "Note: Since MySQL 5.5.3 you should use utf8mb4 rather than utf8. They both refer to the UTF-8 encoding, but the older utf8 had a MySQL-specific limitation preventing use of characters numbered above 0xFFFD." 1) Is there any drawbacks in using utf8mb4, or it is recommended for use from now on?
  24. Hi I have been working on building a custom post a result set to a database which thankfully I have now managed with some help, now I am working on the other end of this project the displaying the saved data back to users, From the start of this I have an online tournament hosting group that go to my form and post a list of player names with points earned per tournament. Once the form is submitted it's sent to my form_processing.php where the results are exploded and split into 2 arrays "$player_name, $points" Then on the INSERT I have an INSERT $sql = "INSERT into `bg_points` (`player_name`, `points`) values (?, ?) on duplicate key update points = points + ?"; to of course update current player points if the exist or add new records if not. Then finally saved into my DB table, now I am working on building the page to display these points back to the players so they can track their earned points and standings each month. which is easy enough I just call an MySQL SELECT * FROM statement on the DB table that's done, Now I need to sort these results in lowest to highest order by points so if player1 has 120 points player2 has 50 points player3 has 75 points player4 has 5 points then I need to be displaying these back as player4 player2 player3 player1 I have had a look online for some possible examples to help guide me into this and I either get HTTP 500 or just no effect at all. here is the very basic code I have put together so far which I can and will update and add into my site framework once I have it in order and working... <HTML> <head></head> <body bgcolor="#0000FF"> <?PHP $servername = "localhost"; $username = "***********"; $password = "*******"; $dbname = "***********"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } //output the saved data $sql = "SELECT * FROM `bg_points` "; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo "id: " . $row["id"]. " $nbsp $nbsp Playerv Name: " . $row["player_name"]. " $nbsp $nbsp Points: " . $row["points"]. "<br>"; } } else { echo "0 results"; } $conn->close(); ?> </body> </html> thanks for any help or ideas in advanced
  25. Hi I am having trouble inserting data into my MySQL database. This is my PHP code ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); static $connection; if(!isset($connection)) { $connection = new mysqli("localhost","username","password"); } if ($connection->connect_error) { die("Connection failed: " . $connection->connect_error); } $stmt = $connection->prepare("INSERT into Product(product_title,product_price,product_availability,productImage_1,productImage_2,productImage_3,productImage_4,product_description,product_shipping,product_pickup) VALUES(?,?,?,?,?,?,?,?,?,?)"); $product_title = $_POST['title']; $product_price = $_POST['price']; $product_availability = $_POST['stock']; $null = NULL; $product_description = $_POST['description']; $product_shipping = $_POST['postage']; $product_pickup = $_POST['pickup']; $stmt->bind_param('sisbbbbsis',$product_title,$product_price,$product_availability,$null,$null,$null,$null,$product_description,$product_shipping,$product_pickup); $stmt->send_long_data(3, file_get_contents($_FILES['img1']['tmp_name'])); $stmt->send_long_data(4, file_get_contents($_FILES['img2']['tmp_name'])); $stmt->send_long_data(5, file_get_contents($_FILES['img3']['tmp_name'])); $stmt->send_long_data(6, file_get_contents($_FILES['img4']['tmp_name'])); $stmt->execute(); $stmt->close(); $connection->close(); echo "Product inserted successfully"; I am also getting these errors. Notice: Undefined index: title in /Applications/MAMP/htdocs/Bourke/insertproduct.php on line 61 Notice: Undefined index: price in /Applications/MAMP/htdocs/Bourke/insertproduct.php on line 62 Notice: Undefined index: stock in /Applications/MAMP/htdocs/Bourke/insertproduct.php on line 63 Notice: Undefined index: description in /Applications/MAMP/htdocs/Bourke/insertproduct.php on line 67 Notice: Undefined index: postage in /Applications/MAMP/htdocs/Bourke/insertproduct.php on line 68 Notice: Undefined index: pickup in /Applications/MAMP/htdocs/Bourke/insertproduct.php on line 69 Fatal error: Call to a member function bind_param() on boolean in /Applications/MAMP/htdocs/Bourke/insertproduct.php on line 71 Thanks in advance.
×