Jump to content

Search the Community

Showing results for tags 'database'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. Hey all, Been a while since ive coded php and am stuck already. Here is the issue, i have a list being made from the database using id as the identifier. so the link being rendered is client.php?id=1 etc. im trying to use this info to populate the page it directs too using the folowing add on script: <? $lin = mysqli_connect("*","*","*!","*") or die("Error 1 " . mysqli_error($lin)); //consultation: $query = "SELECT * FROM Clients WHERE ID=$id " or die("Error 2 in the consult.." . mysqli_error($lin)); //execute the query. $result = mysqli_query($lin, $query); while($row = mysqli_fetch_array($result)) { $name = $row['1']; $address = $row['2']; $city = $row['3']; $postcode = $row['4']; $phone = $row['5']; $email = $row['6']; } ?> Problem is this isnt working and i have no idea why Can anyone help?
  2. I'm learning how to use PHP and prepared statements with mysqli/php and can't seem to get this code to output data. I get no error messages, just nothing output. This is the complete code, it's rather simple, created from an example I found online. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Untitled</title> </head> <body> <?php require_once('/includes/conn.inc.php'); $conn = dbConnect('read'); $stmt = $conn->stmt_init(); // Create a prepared statement if($stmt->prepare("SELECT 'name' FROM comments WHERE 'approved' = ?")) { // Bind your variable to replace the ? $stmt->bind_param('s', $approved); // Set your variable $approved = "Y"; // Execute query $stmt->execute(); // Bind your result columns to variables $stmt->bind_result($name); // Fetch the result of the query while($stmt->fetch()) { echo $name . ' - ' . "found"; // John Doe - Unknown... } // Close statement object $stmt->close(); } ?> </body> </html>
  3. Hi, I am trying to make a website that stores and prints information entered by users. The site consists of one database that contains two tables. The first table stores all of the users details such as their username, password and address. The second is store users prescription items in. I have the login system completely working, and it shows all of the users details stored in the table once they have logged in. Now, I need the site to do more. Once the user has logged in, it want it to display all prescription items belonging to that user. The table consists of several fields, one of which is the users username. This means, when the user creates a new prescription item, it is sotred in the table and in one of the row cell's, their username is stored. I then want to be able to search for all records by that user and display them. I have managed to create some code which gets the information from the table and displays it on the users console page, however it gets information from all users, not just their account. For example, if someone had a username of 'fruit', I want it to search the prescription table for all records with the username 'fruit' and display them. Here is my code so far: <?php include_once "base.php"; $result = mysql_query("SELECT * FROM prescriptions") or die(mysql_error()); $list = ''; while ($row = mysql_fetch_array($result)) { $user_id = $row["user_id"]; $drug = $row["drug"]; $strength = $row["strength"]; $quantity = $row["quantity"]; $list .= '' . $drug . ' ' . $strength . ' ' . $quantity . '<br/>'; } ?> I would appreciate any help on this problem. Thanks in advance
  4. hi ive been trying to sort this update button out but i keep getting errors and got no clue how to fix it. heres the code. <?php $con=mysqli_connect("localhost","","","lcm"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $sql = "Select * from tbl_contactinfo"; if (isset($_POST['update'])){ $UpdateQuery = "UPDATE tbl_contactinfo SET Name='$_POST[Name]', Address='$_POST[Address]' WHERE Name = '$_post[hidden]'"; mysql_query($UpdateQuery,$con); }; if ($result = mysqli_query($con, $sql)){ echo "<table border='1'> <tr> <th>Name</th> <th>Address</th> </tr>"; while($row = mysqli_fetch_array($result)) { echo "<form action = index1.php method =post>"; echo "<tr>"; echo "<td>" . "<input type= text name =Name value =" . $record['Name'] . "</td>"; echo "<td>" . "<input type= text name =address value =" . $record['Address'] . "</td>"; echo "<td>" . "<input type= hidden hidden =Name value =" . $record['hidden'] . "</td>"; echo "<td>" . "<input type= submit name = update value=update". " </td>"; echo "</form>"; } echo "</table>"; mysql_close($con); ?> if someone could help id really apreciate it.
  5. Hi all I've been having issues making this code, I'm a huge noob and have been watching youtube videos for the past couple of days and trying to create a website with a database of my movies.(I know there are programs for this but I would like to make my own) This site is only going to be running on localhost. I'm having issues uploading my info(mainly the image for Poster) and if anyone could look at my code/database setup and help me out that would be great First here is a screenshot of what my database looks like. http://i.imgur.com/14DQTCh.jpg Next here is my index.html file <html> <head><title>Add Movie or Tv show</title></head> <body> <form enctype="multipart/form-data" id="myForm" action="addedinfo.php" method="post"> <h1 align="center"><strong>Add Movie or TV Show to Database</strong></h1> <p> </p> <p>Movie Name: <input type="text" name="Movie_Name" /><br /> </p> <p><label> Poster</label> <input type="FILE" name="Poster"> ><br> </p> <p>Genre: <select multiple name="Genre" id="Genre"> <option value="All" style="text-indent: 0px;" selected="selected">All</option> <option value="Action" style="text-indent: 0px;">Action</option> <option value="Adventure" style="text-indent: 0px;">Adventure</option> <option value="Animation" style="text-indent: 0px;">Animation</option> <option value="Biography" style="text-indent: 0px;">Biography</option> <option value="Comedy" style="text-indent: 0px;">Comedy</option> <option value="Crime" style="text-indent: 0px;">Crime</option> <option value="Documentary" style="text-indent: 0px;">Documentary</option> <option value="Drama" style="text-indent: 0px;">Drama</option> <option value="Family" style="text-indent: 0px;">Family</option> <option value="Fantasy" style="text-indent: 0px;">Fantasy</option> <option value="Film-Noir" style="text-indent: 0px;">Film-Noir</option> <option value="History" style="text-indent: 0px;">History</option> <option value="Horror" style="text-indent: 0px;">Horror</option> <option value="Mystery" style="text-indent: 0px;">Mystery</option> <option value="Romance" style="text-indent: 0px;">Romance</option> <option value="Sci-Fi" style="text-indent: 0px;">Sci-Fi</option> <option value="Short" style="text-indent: 0px;">Short</option> <option value="Sport" style="text-indent: 0px;">Sport</option> <option value="Thriller" style="text-indent: 0px;">Thriller</option> <option value="War" style="text-indent: 0px;">War</option> <option value="Western" style="text-indent: 0px;">Western</option> </select> </p> <p> <label>IMDB Rating:</label> <select name="IMDB_Rating" id="IMDB_Rating"> <option value="0" style="text-indent: 0px;" selected="selected">All</option> <option value="9.9" style="text-indent: 0px;">10</option> <option value="9" style="text-indent: 0px;">9+</option> <option value="8" style="text-indent: 0px;">8+</option> <option value="7" style="text-indent: 0px;">7+</option> <option value="6" style="text-indent: 0px;">6+</option> <option value="5" style="text-indent: 0px;">5+</option> <option value="4" style="text-indent: 0px;">4+</option> <option value="3" style="text-indent: 0px;">3+</option> <option value="2" style="text-indent: 0px;">2+</option> <option value="1" style="text-indent: 0px;">1+</option> </select> </p> <p>Quality: <label class="label">Quality:</label> <select name="Quality" id="Quality"> <option value="All" style="text-indent: 0px;" selected="selected">All</option> <option value="1080p" style="text-indent: 0px;">1080p</option> <option value="3D" style="text-indent: 0px;">3D</option> <option value="480p" style="text-indent: 0px;">480p</option> <option value="720p" style="text-indent: 0px;">720p</option> <option value="DVD" style="text-indent: 0px;">DVD</option> <option value="HDRip" style="text-indent: 0px;">HDRip</option> </select> </p> <p> Year: <input type="text" name="Year" /><br /> </p> <p>Trailer: <input type="text" name="Trailer" /><br /> </p> <button id="sub">Submit</button> </form> <span id="result"></span/ </body> </html> As you can see I'm trying to post the following information Movie Name, Poster of the movie, Genre, Rating, Quality, Year, and the Trailer Next I have my connection script db.php <?php $conn = mysql_connect("localhost", "root", "spencer"); $db = mysql_select_db('movies'); ?> Next my addinfo.php <?php include_once('db.php'); $Movie_Name = $_POST['Movie_Name']; $Poster = $_POST['Poster']; $Genre = $_POST['Genre']; $IMDB_Rating = $_POST['IMDB_Rating']; $Quality = $_POST['Quality']; $Year = $_POST['Year']; $Trailer = $_POST['Trailer']; if (mysql_query ("INSERT INTO movieinfo VALUES ('','$Movie_Name','$Poster', '$Genre', '$IMDB_Rating', '$Quality', '$Year', '$Trailer')")) echo "Successfull"; else echo "Failed" ?> and lastly I have a little javascript my_script.js $("#sub").click( function() { $.post( $("#myForm").attr("action"), $("#myForm :input").serializeArray(), function(info){ $("#result").html(info); }); clearInput(); }); $("#myForm").submit( function() { return false; }); function clearInput() { $("#myForm :input").each( function() { $(this).val(''); }); } The error I get is: Notice: Array to string conversion in C:\xampp\htdocs\movies\addedinfo.php on line 12 Successfull When I look at the database I notice a couple of things: 1 the image is 5B so I don't think it uploads right, along with in the Genre only seems to pick up the last selection of the multiple selection My overall goal is to make a website that I can use to have a database of all my movies and tv shows on that I can add too and search through to find something to watch. So right now I'm making code to upload movies to the database, later I will make a site that will show all of the different movies I have and will be searchable through the movie name, genre, rating, quality and or year. I appreciate any help very much!
  6. Hello, I am fairly new to PHP coding, after having spent years coding websites that just use HTML, CSS script, and JAVA script. I am working on a project and, when I am seeking the answers for my coding issues, I am just getting overwhelmed. I am not a typical new user, for I have no issue in obtaining the information myself. I was hoping that one of you would be able to just steer me in the right direction? I am working on a post-by-post fantasy rpg where we want to have our character database be set-up with like a Wiki (we are going to use the open source WikiMedia system), but the characters in our rpg earn traits through money earned in in-game events. What we need is a shop (Bazaar, really) system that allows a user to log into their account, spend the money on what they want, and the wiki automatically gets updated with the purchased item. We also need for the shop system to allow staff members to reward the players money and for a visual events log to show how much money and why the money was given (to stop people from claiming that we are cheating). Our money system makes this difficult as well because we keep track of total money earned and what is left to spend. For example, a character named Fluffy earns 1000 points. They buy a horn for 800 points. The system shows that their coffers have 200/1000 points. I realize that I am very new to all of this and that requests like this are annoying, but I am willing to learn the coding. I was just wondering if anyone could point me in the right direction. Thank you kindly for your time.
  7. Hello to all! A friend of mine ask what is the difference between mysql table innodb and MyISAM..... A have made a fiew search but i can't get the real answer ... Also, i check the database of my website and 50% are innodb and 50 % are MyISAM.... I made a lot a select and insert... have a few update.... Do you have an advice to give me? Thanks! Pascal
  8. Good Day I was wondering if anyone could help me mysql does not seem to be working correctly MySQL server version: -- 5.5.24 the raw MySQL statement in question [mysql_query ("UPDATE ".$db_prefix."banner SET `shown`=0");] any errors that MySQL returns to the client [No ERROR just not updating] the table structure & column indexes of the relevant tables [-- -- Database: `second` -- -- -------------------------------------------------------- -- -- Table structure for table `shc_banner` -- CREATE TABLE IF NOT EXISTS `shc_banner` ( `idx` int(10) unsigned NOT NULL AUTO_INCREMENT, `banner_type` char(3) NOT NULL DEFAULT '', `cat_id` int(10) NOT NULL, `dir_id` char(3) NOT NULL, `banner_order` varchar(255) NOT NULL, `banner_file` varchar(255) NOT NULL DEFAULT '', `banner_title` varchar(255) NOT NULL DEFAULT '', `banner_url` varchar(255) NOT NULL DEFAULT '', `viewslimit` int(11) NOT NULL COMMENT 'After this amount of views has been reached, the ad will be expired. - 0 To disable', `clickslimit` int(11) NOT NULL COMMENT 'After this amount of clicks has been reached, the ad will be expired. - 0 to disable', `banner_target` varchar(255) NOT NULL, `banner_width` int(4) NOT NULL, `banner_height` int(4) NOT NULL, `banner_owner` varchar(255) NOT NULL DEFAULT '', `banner_dir` varchar(1000) NOT NULL, `banner_cat` varchar(1000) NOT NULL, `banner_hits` varchar(255) NOT NULL, `banner_clicks` varchar(255) NOT NULL, `show` int(1) DEFAULT NULL, PRIMARY KEY (`idx`), KEY `banner_type` (`banner_type`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Random Banner' AUTO_INCREMENT=170 ; -- -- Dumping data for table `shc_banner` --] the EXPLAIN output for your query: the query should update the database table but it does not in attached file line 64-67 a clear and concise description of what you want this statement to achieve: That the statment should update my table but it does not a description of what it's currently doing that's not to your liking: its not updating the table/ not even sowing up in debug mode localhost not live if anybody can help I'm new to this and could not find any solution at all Regards Rhino window.php
  9. Hello, I need some help and information about how to calculate. is it possible to make a calculation directly from database and output ? here below an example. database : Expense table: Money ---------------- | Gas | Gasoline | Diesel | total | ................................................................................................... $50 $20 $10 = $80 So what i want is to make the calculation like here above directly from database like today whe used ................................................................................................... $10 $5 $10 = $25 Thank in advance/
  10. I am trying to create MySQL database using PHP. Here is my code. db-config.php <html> <head> <title> Database Configuration </title> </head> <body> <?php $host = "localhost"; $user = "root"; $pass = "123456789"; $database = "hello"; $mysql = new mysqli($host,$user,$pass); if($mysql->connect_error) { die ("Could not connect to database"); } ?> createdb.php <html> <head> <title> Create tables </title> </head> <body> <?php include("\db-config.php"); if(!$a = ($mysql->query("CREATE DATABASE $database")))die("Could not create database"); echo "Successfully created database"; $table = "user"; $td = "userid MEDIUMINT(10) DEFAULT '0' NOT NULL AUTO_INCREMENT,"; $td .= "username VARCHAR(20) BINARY NOT NULL,"; $td .= "password VARCHAR(20) BINARY NOT NULL,"; $td .= "name VARCHAR(20) BINARY NOT NULL"; $test = $mysql->query("SELECT DATABASE $database"); if(!(mysqli_select_db($mysql,$database)))die("Could not connect to database"); if(!(mysqli_query("CREATE TABLE $table ($td)")))die("Could not create tables"); echo "Successfully created tables"; ?> </body> </html> It always results in die message. Please help.
  11. Hello, im a new user here. Im now working on a project called student attendance management sytem. I have doing all the necessary tables in database which is admin, lecturer, student, parent, attendance and grade. Ok so im now working on a 1st page which is a login page. Right now i have finished the coding and what im gonna ask u all is how to make sure that when i clicked 'login', it not only detect the admin table but all of other tables? <html> <head> <title> Login Form </title> </head> <body> <form method='post' action='login.php'> <table width='400' border='5' align='center'> <tr> <td align='center' colspan='5'><h1>Login Form</h1></td> </tr> <tr> <td align='center'>Username:</td> <td><input type='text' name='username' /></td> </tr> <tr> <td align='center'>Password:</td> <td><input type='password' name='pass' /></td> </tr> <tr> <td colspan='5' align='center'><input type='submit' name='login' value='Log In' /></td> </tr> </table> </form> </body> </html> <?php mysql_connect("localhost","root",""); mysql_select_db("student_attendance"); if(isset($_POST['login'])){ $username = $_POST['username']; $password = $_POST['pass']; $check_user = "select * from admin where username='$username' AND pass='$password'"; $run = mysql_query($check_user); if(mysql_num_rows($run)>0){ echo "<script>alert('You are logged in')</script>"; } else { echo "<script>alert('username or password is incorrect!')</script>"; } } ?>
  12. I need to develop Feedback module in PHP/MySQL. I would like to know the database design and flow to manage this system. There are questions for 2 tools which i need to store in my databse and need to create report like %of Positive Response, % of Negative Response, No. of Users for Tool1/2 etc. It would be great if i have any similar example/code/link etc. Thanks in advanced for your input. Tool 1 1.Are you satisfied with the performance of the tool ? Yes/No 2.Are you satisfied with the support provided? Yes/No IF NO, Why ? 3.If you need to improve, they are the three major changes you propose Yes/No IF Yes, -----****---- 4.What are the general points (up to 3) that you would like to improve on the project Yes/No IF Yes, -----****---- Tool 2 1.Are you satisfied with the performance of the tool ? Yes/No 2.Are you satisfied with the support provided? Yes/No IF NO, Why ? 3.If you need to improve, they are the three major changes you propose Yes/No IF Yes, -----****---- 4.What are the general points (up to 3) that you would like to improve on the project Yes/No IF Yes, -----****----
  13. I am trying to update 3 images of same product_id. I have a different product_table and Product_images table. The product_images table has 5 fields; image_id, product_id, name, images, ord. I am trying to update images for any specific product_id. The problem I was facing before was that it set the same 'Image' for all of the three 'images', that why I add 'ord' filed and it solver that problem. Now I have a new problem. I am unable to understand where to write update image' query. If I write it inside for loop then it runs 'Update Query' 6 times and if I write it outside for loop then its unable to find out $ord[] variable. Kindly tell the way to resolve this problem. Given below is the part of code I am working on. /* * ------------------- IMAGE-QUERY Test 002 -------------------- */ if (isset ( $_FILES ['files'] ) || ($_FILES ["files"] ["type"] == "image/jpeg")) { $i = 1; /* * ----------------------- Taking Current Order_id ------------------------ */ // $order_sql= "select MAX(ord) from product_images"; $order_sql = "SELECT ord from product_images where product_id=$id"; $order_sql_run = mysql_query ( $order_sql ); echo mysql_error (); for($i = 1; $i <= $order_fetch = mysql_fetch_array ( $order_sql_run ); $i ++) // while ($order_fetch= mysql_fetch_array($order_sql_run)) {) echo 'ID ' . $order_id [$i] = $order_fetch [(ord)]; } /* * ----------------------- Taking Current Order_id ------------------------ */ foreach ( $_FILES ['files'] ['tmp_name'] as $key => $tmp_name ) { // echo $tmp_name."<br>"; // echo 'number<br>'; echo $image_name = $_FILES ["files"] ["name"] [$key]; $random_name = rand () . $_FILES ["files"] ["name"] [$key]; $folder = "upload/products/" . $random_name; move_uploaded_file ( $_FILES ["files"] ["tmp_name"] [$key], "upload/products/" . $random_name ); echo '<br>'; echo $sql = "update product_images set name= '$random_name',images= '$folder' where product_id=$id andord=$order_id[$i]"; if ($query_run = mysql_query ( $sql )) { echo '<br>'; echo 'Done'; } else { echo mysql_error (); } // $i=$i+1; } } /*------------------- IMAGE-QUERY Test 002 --------------------*/
  14. I followed this YouTube tutorial on how to make a registration page with a username and password. Also a login page that checks you credentials against the database and logs you in. After you are logged in, it starts a session. That's where it stopped. I want to do two things. I want to display on the site if you are logged in or if you are visiting as a guest. And my site's main purpose is photo uploading. So I would like to have under each uploaded photo the username of who uploaded it, or guest if they were not registered. I really am clueless on where to go from here. So if anyone could even point me in the right direction that would be great. I am teaching myself to program and am totally new to sessions, users etc. Here is the config.php file <?php $sql = mysql_connect("localhost","root","") or die(mysql_error()); $slect_db = mysql_select_db("login", $sql); ?> The registrer.php file <?php include ('config.php'); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string(md5($_POST['password'])); if (empty($username)) { echo("You have to fill in an username!"); } else { if(empty($password)){ echo ("You have to fill in a password!"); } else { $query = mysql_query("SELECT * FROM users WHERE username = '$username'"); $rows = mysql_num_rows($query); } if ($rows > 0) { die("Username taken!"); } else { $user_input = mysql_query("INSERT INTO users (username, password) VALUES ('$username','$password')"); echo("Succesfuly Registered!"); } } } ?> <html> <head> <title>Register</title> </head> <body> <form action="register.php" method="post"> Username: <input type="text" name="username" /><br/> Password: <input type="password" name="password"/><br/> <input type="submit" value="Register!"/> </form> </body> </html> and the login.php file <?php include ("config.php"); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string(md5($_POST['password'])); $query = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password'"); $query_rows = mysql_num_rows($query); if($query_rows > 0) { echo ("Succesfull Login!"); session_start(); $_SESSION['login'] = "1"; } else { echo ("Username and/or password incorrect"); } } ?> <html> <head> <title>Login</title> </head> <body> <form action="login.php" method="post"> Username: <input type="text" name="username" /><br/> Password: <input type="password" name="password"/><br/> <input type="submit" value="Login!"/> </form> </body> </html>
  15. Hello: Any PHP MYSQL experts out there willing to help? I would greatly appreciate it. I built a web directory using WordPress Platform and I am trying to PULL data from my database and display it on the home page. I have the following code: $sql = "SELECT * FROM `agents` LIMIT 0, 30 "; I know this isn't much to work with but I am happy to answer any question related to my tables. Regards, John.
  16. Update is not working.. UPDATE Customers SET ContactName='Alfred Schmidt', City='Hamburg' WHERE CustomerFirstName='Alfreds' AND CustomerLastName='Futterkiste' Thanks in advanced.
  17. HI i am new to php coding, i am developing a blog site. I want to know what will be the database table for cms of this blog; blog is about posting a post, editing the post, comments, admin panel. What will be database tables and what should be entries?
  18. Hi. I'm trying to display a list of items i have in my database. It displayed correctly as how i wanted it to. However, there is a button which popup a jQuery div tag. It pop up correctly, just that it only show the 1st content in my database table. I believe it is the jQuery ID that is confused but I just don't know how to define the ID separately in jQuery. Below is my code: HTML: //My Button <a href="#" id="map_link" class="topopup-map"> <div class="self-drive-view-map-button"> <img src="images/content/map-icon.png" height="23px"> </div> </a> //My Pop-Up Div <div id="toPopup-map"> <div id="popup_content_map"> <?php echo $map; ?> </div> </div> jQuery: jQuery(function($) { $("a.topopup-map").click(function() { loading(); setTimeout(function(){ loadPopup(); }, 500); return false; }); /* event for close the popup */ $("div.close").hover( function() { $('span.ecs_tooltip').show(); }, function () { $('span.ecs_tooltip').hide(); } ); $("div.close").click(function() { disablePopup(); }); $(this).keyup(function(event) { if (event.which == 27) { disablePopup(); } }); $("div#backgroundPopup").click(function() { disablePopup(); }); $('a.livebox').click(function() { alert('Hello World!'); return false; }); /************** start: functions. **************/ function loading() { $("div.loader").show(); } function closeloading() { $("div.loader").fadeOut('normal'); } var popupStatus = 0; function loadPopup() { if(popupStatus == 0) { closeloading(); iframe_code = $('#toPopup-map').html(); $('#toPopup-map').html(iframe_code).fadeIn(500); $("#backgroundPopup").css("opacity", "0.7"); $("#backgroundPopup").fadeIn(0001); popupStatus = 1; } } function disablePopup() { if(popupStatus == 1) { $('#toPopup-map').html(iframe_code).fadeOut(500); $("#backgroundPopup").fadeOut("normal"); popupStatus = 0; } } /************** end: functions. **************/ }); // jQuery End Any solution?
  19. Hello, I would like to know how i can develop interface between XML and MDB files? Actually, i need to convert files from XML into MDB and vice versa. Approximately, how much time it will take?
  20. Hey all I was wondering what are my options for generating a report? I developed the database and the table in myphpadmin and I was wondering what were the common tools to gernate reports that only pull specific info from the form data? My boss wants reports that also show what images a user uplaods, I'm a bit confused about how to go about doing this since I just started out and am a Junior Dev. I figured report generations were handled through Access and whatever admins have access to the databases. I did try to find some tutorials so I can run through them, but everything I find is suggesting actual management programs and report generating programs. I'll be setting this up over the weekend it looks like. And I would to learn this and grow. Thank you for your time.
  21. Hi, my name is Shaan. I joined this forum to learn PHP language as I am clearly new to it. I was wondering if anyone could please tell me in which section do I post general PHP questions, for example Questions like website like Facebook, where do Facebook stores all of the images and pictures thats get uploaded on the website. I have heard that they do not store the uploaded images to the database but someone else. Could anyone please tell me in which section do I post question like this. Sorry this is a first forum I have joined ever which is why I am a bit confused. Regards Shaan
  22. So I am working on a site which take's people's YouTube links and automatically embeds them into the website. The site's purpose isn't the playback of the videos rather the video thumbnail itself. I'm not saying that the site does not use the <iframe> tag to embed the video but it doesn't matter if the videos do play or not depending on things like Vevo or UMG rights etc... My problem is, I don't know how to take a full youtube url that a person enters and place it within a container that is an iframe, the url of course goes into the src=" " field. I found something that supposedly does this but I don't know how to apply it. I don't know how to take the link which comes in from a form and then before storing it into the database, apply a function to it to modify the string (add the container) The guy who wrote the code below said something easy yet I don't understand it... "all you have to do is parse the string then call the function" Can someone first answer, is this code actually doing what I want to do or do I misunderstand it? My understanding is, once a link is somehow accessed by the function autolink($string), it then first fixes the link to be sure it is proper, then if it is proper ($match), it is placed within the <iframe> container which happens to be an embed object. Please ignore my syntax so how do I take that string url link entered by the user on the form, then modify it, store it and retrieve to be displayed in an iframe? If you want to see what exactly I am doing, this is the site I am trying to make it on. You can see my other entries already which are just tests, I will empty the database once I get this thing running. It seems so simple but my ignorance hinders my progress. http://jchive.com/comments.html Thanks for any help. This is the link where the code came from : http://stackoverflow.com/questions/412467/how-to-embed-youtube-videos-in-php because it isn't the only code on the site, I will post the code: echo '<div id="chat_message">'.autolink($string).'</div>'; /****************Function to include****************/ <?php function autolink($string){ // force http: on www. $string = str_ireplace( "www.", "http://www.", $string ); // eliminate duplicates after force $string = str_ireplace( "http://http://www.", "http://www.", $string ); $string = str_ireplace( "https://http://www.", "https://www.", $string ); // The Regular Expression filter $reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/"; // Check if there is a url in the text $m = preg_match_all($reg_exUrl, $string, $match); if ($m) { $links=$match[0]; for ($j=0;$j<$m;$j++) { if(substr($links[$j], 0, 18) == 'http://www.youtube'){ $string=str_replace($links[$j],'<a href="'.$links[$j].'" rel="nofollow" target="_blank">'.$links[$j].'</a>',$string).'<br /><iframe title="YouTube video player" class="youtube-player" type="text/html" width="320" height="185" src="http://www.youtube.com/embed/'.substr($links[$j], -11).'" frameborder="0" allowFullScreen></iframe><br />'; }else{ $string=str_replace($links[$j],'<a href="'.$links[$j].'" rel="nofollow" target="_blank">'.$links[$j].'</a>',$string); } } } return ($string); } ?>
  23. Hello I am trying to insert values in my database from a dynamic drop down list. I have created the following program, its not given me any error message, but also its not inserting any record in database. Kindly check it and tell me where is the problem. I have also echo the fields which i am inserting in database, and all the fields are entering correctly in variables. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> </body> </html> <?php session_start(); if(isset($_SESSION['username'])) { include 'connect.php'; $select_query= 'Select * from category'; $select_query_run = mysql_query($select_query); echo " <form action='insert_product.php' method='POST' ></br> Product Name: <input type='text' name='product_name' /></br> Price : <input type= 'text' name= 'price' /></br> Description : <input type='text' name='description' />*Seperate by Comma</br> "; // Drop Down Display echo "<select name='category'>"; while ($select_query_array= mysql_fetch_array($select_query_run) ) { echo "<option value='".$select_query_array['category_id']."' >". htmlspecialchars($select_query_array["name"])."</option>"; } $selectTag= "<input type='submit' value='Insert' /></select></form>"; echo $selectTag; //Drop Down End! if(isset($_POST['product_name']) && isset($_POST['price']) && isset($_POST['description']) ) { echo $product_name = $_POST['product_name']; echo $price = $_POST['price']; echo $description = $_POST['description']; echo $category = $_POST['category']; //Problem Area $query= "insert into products (name, price, description, category_id ) VALUES( '$product_name', $price, '$description', $category )"; if($query_run= mysql_query($query)) { echo 'Data Inserted'; } else { 'Error In SQL'.mysql_error(); } } else { echo 'empty Field'; } } else { echo 'You Must Log in To View this Page!'; } ?>
  24. I was given this function question for an interview. I don't think I'm interested in the job and therefore will not submit this, but I am curious how to answer this. Once I start something like this, I can't just quit without knowing the answer. Questions: 1. Does the function have any errors? 2. What is the purpose of the function? 3. What can be done to improve it? 4. Why is isset() used instead of a simple conditional used above it? 5. What assumptions can you make about the database structure? function auto_query( $table, $vars ) { $_result = $this->query( "EXPLAIN $_table_name" ); $_fields = array(); // Empty array assigned to variable while( $_row = $_result->fetchRow() ) { array_push( $_fields, $_row['Field'] ); // Push one or more elements onto the end of array } if( $vars[$table . 'id'] ) { $_query = "UPDATE $_table SET "; } else { $_query = "INSERT INTO $_table SET " . $_table . '_date_created = NOW(), '; } $_query_params = array(); // Empty array assigned to variable foreach( $_fields as $_field ) { if( isset( $_vars[$_field] ) ) { $_query_params[] = "$_field = " . $this->dbh->quoteSmart( $_vars[$_field] ); } } $_query .= implode( ',', $_query_params ); // Join array elements with a string if( $_vars[$_table . '_id'] ) { $_query .= " WHERE {$_table}_id = " . $this->dbh->quoteSmart($_vars[$_table . '_id']); } return $_query; }
  25. Hi I'm an Illustrator with little knowledge of web development, i'm experienced in HTML, CSS. I'm ok in PHP and Jquery and SQL I was wondering if it was possible to make a website where i can upload my illustrations to the database and view them on the website (while also having a jquery style on the images). like this: http://www.twospy.com/galleriffic/example-2.html if yes would you be able to give me any tutorial to teach me how to do it. if you can't find any toturials would you be able to give me tips. e.g. will it be easier to use a different language (i'm willing to teach my self), is there any opensource web development software that will help me do this Thank you very much for your help
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.