Problem Displaying Picture Stored In Mysql Database Programming Web Development by ptara1 I'm trying to display a picture stored in a msyql database. I have the following script, picscript.php, to call … CRUD with multiple tables Programming Databases by Hue_1 … $photo_link = mysqli_real_escape_string($_POST["photo_link$i"]); //mysqli_real_escape_string to prevent msyql injection $last_name = mysqli_real_escape_string($_POST["last_name$i"]); //sanitize the… Re: Authenticate users for mysql database using C Programming Software Development by Hannahlv … the code like this : [CODE] char sQuery[1000]; printf("msyql>"); fgets(sQuery, sizeof sQuery, stdin); if (mysql_query(conn… Re: Authenticate users for mysql database using C Programming Software Development by Hannahlv I copy those lines : [CODE] char sQuery[1000]; printf("msyql>"); fgets(sQuery, sizeof sQuery, stdin); printf("%s&… Re: Which is better? Tons of separate tables with a little data or one big table? Programming Databases by igeek … find a way to hack in and get the universal msyql username/pass then I'm screwed b/c everything is… Re: referential issue Programming Databases by tesuji … had had several serious problems with older mysql databases because msyql has its very own (kind of inconsiderate) notion on relational… Re: Totals from query Programming Databases by tesuji …;Total Quantity" desc;[/CODE] Should function on mysql for msyql manual tells that subqueries in from clause would be fully… Re: creating a website using phpcake or write my own ?? Programming Web Development by veedeoo … integrated tools for PHP with smarty plugins, and a reliable msyql class. That's should suffice to whatever what I have… Re: Respond to form with file Programming Web Development by veedeoo … their server? If you can manage to set up a msyql server this should be an easy task for you. Here… Re: how do i connect server database from localhost Programming Web Development by veedeoo … the permission as "GRANT ALL". Please consult the msyql documentation for this. If you are currently using a cpanel… function not returning msyql rows Programming Web Development by fobos Hello all, im having some problem, i have a function call dbconn which i run after my session. i can successfully connect to the database and run the mysql statement outside of the function with no problems. However, when i put it in the function and return it, nothing happens. Example: index.php <?php include_once 'includes/db_connect… Re: function not returning msyql rows Programming Web Development by iamthwee Could this be an issue to do with global connections? If you explicitly pass in conn,host,username, password as variables to the function does it work? Second shouldn't you be mysql escaping sessionid. Htmlentities is not the same as mysql escape. Re: function not returning msyql rows Programming Web Development by fobos No issue with global connections. if i put the mysql_query and assoc in index.php and run it that way, everything works. but since if have it in the function, it just wont return. if i put an echo after the if statement for the connection, it echos. Also, i include above the function, an include which has the defines for username password and db.… Re: function not returning msyql rows Programming Web Development by diafol nothing should be echoed after return. SHow the code you used. Re: function not returning msyql rows Programming Web Development by diafol You'd do far better to use mysqli/PDO. This code looks 5-10 years out of date. Re: function not returning msyql rows Programming Web Development by iamthwee I think I sussed it return $rows; change that to echo $rows; When you call a function that returns something you need to echo it. Using return 'something' won't print anything to the web browser. That's probably why it is blank... but you need to do as diafol says... post a more complete code sample. Re: function not returning msyql rows Programming Web Development by fobos This is the code i use. I will just revert to mysqli to see what i get. Thanks for the help right now. If i have anything else, ill repost it. Thanks again guys. Re: function not returning msyql rows Programming Web Development by fobos Man this is rough, how do i return rows in a function using mysqli. Heres what i have: db_connect.php <?php function dbconn($autoclean = false) { $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); $result = $mysqli->query("SELECT * FROM users WHERE id = '2'"); $rows = $result->fetch_array(MYSQLI_ASSOC… Re: function not returning msyql rows Programming Web Development by diafol ## functions.php ## function connect() { $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); return $mysqli; } ## mypage.php ## require 'functions.php'; $db = connect(); $result = $db->query("SELECT * FROM users WHERE id = '2'"); $rows = $result->fetch_array(MYSQLI_ASSOC); … Re: function not returning msyql rows Programming Web Development by iamthwee <?php dbconn(); echo $rows["username"]; ?> ^^That right there tells me you don't even know how to use functions. Go back to basics bro. The issue here isn't using mysql over mysqli although diafol makes a good point... it is deprecated. The issue is you don't know the basics of using a function and how to return … Re: function not returning msyql rows Programming Web Development by fobos > ^^That right there tells me you don't even know how to use functions. Go back to basics bro. If i wanted a dickhead answer, i would have asked for it. Thanks diafol. Im still learning how that works. Re: function not returning msyql rows Programming Web Development by diafol Perhaps we should remind ourselves that this is primarly a learning forum. Users of all abilities are welcome, and as long as OPs have made an effort, they deserve courteous answers. We can decide whether to reply or not. Re: function not returning msyql rows Programming Web Development by fobos Wait, so was i in the wrong? i noticed aimthwee got two down votes. I do agree with you, but what he said is something that i wasnt expecting. I like this site and i have helped out many of people, but never am im i blunt like that. I was just mearly asking how to return a fetch array in a function. I know your way works diafol, but just trying … Re: function not returning msyql rows Programming Web Development by diafol My comment was not directed at you fobos :) Re: Problem Displaying Picture Stored In Mysql Database Programming Web Development by ptara1 solved the problem. Had to change img tag to: [CODE] <? $ID=$_GET['ID']; echo "<img src='picscript.php?ID=".$ID."'>"; ?> [/CODE]