Everything posted by collie
- Warning: mysql_num_rows() expects parameter 1 to be resource
- Warning: mysql_num_rows() expects parameter 1 to be resource
-
Warning: mysql_num_rows() expects parameter 1 to be resource
i am trying to work on a log in page and keep getting this error whether the login is correct or wrong Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\private_message_system\core\inc\user.inc.php on line 10 <?php // checks a given username and password combination, returning the users id function validate_credentials($user_name, $user_password) { $user_name = mysql_real_escape_string($user_name); $user_password = sha1($user_password); $result = mysql_query("SELECT 'user_id' FROM 'users' WHERE 'user_name' = '{$user_name}' AND 'user_password' = '{$user_password}' "); if (mysql_num_rows($result) != 1) { //line 10 return false; } return mysql_result($result, 0); } ?>
-
insert PDF file into mysql databse
im wanting to use mysql and php to insert PDF files into my database, and then retrieve them and display them. how would i go about doing this
-
php insert into multiple mysql tables
i am trying to take data from a form and insert it into multiple mysql tables. here is the feilds and php script author - auth_id, auth_first, auth_second, auth_telephone, auth_email book - book_id, auth_id, book_genre_id, book_title, book_num_pages, book_synopsis, book_description, book_rating book genre - book_genre_id, book_genre that is all the fields i have in my database this is the code i have, the problem is that it will insert a new author, but wont add in the book from the form. <form id="contact-form" method="post" action="database.php" > <label for="fname">First Name: <span class="required">*</span></label> <input type="text" id="fname" name="fname" value="" placeholder="John" required="required" /> <label for="auth-name">Second Name: <span class="required">*</span></label> <input type="text" id="sname" name="sname" value="" placeholder="Doe" required="required" /><br /> <label for="email">Email Address: <span class="required">*</span></label> <input type="email" id="email" name="email" value="" placeholder="johndoe@example.com" required="required" /> <label for="telephone">Telephone: <span class="required">*</span></label> <input type="text" id="telephone" name="telephone" value="" placeholder="" required="required" /><br /> <label for="genre">Genre: <span class="required">*</span></label> <select id="genre" name="genre" placeholder="please select one..." required="required"> <option value="please-select">Please select one..</option> <option text="murder_mystery" value="1">Murder Mystery</option> <option text="romance" value="2">Romance</option> <option text="sci_fi" value="3">Sci-Fi</option> <option text="horror" value="4">Horror</option> <option text="thriller" value="5">Thriller</option> <option text="screen_plays" value="6">Screen Play's</option> <option text="poetry" value="7">Poetry</option> <option text="childrens" value="8">Children's</option> <option text="non_fiction" value="9">Non-Fiction</option> <option text="comedy" value="11">Comedy</option> <option text="other" value="10">Other</option> </select> <label for="numpages">Number of Pages: <span class="required">*</span></label> <select id="numpages" name="numpages"> <option value="num-page">Please Select one..</option> <option value="0-100">0-100</option> <option value="100-300">100-300</option> <option value="300-500">300-500</option> <option value="500">500+</option> </select><br /> <label for="booktitle">Book Title: <span class="required">*</span></label> <input type="text" id="booktitle" name="booktitle" value="" placeholder="John Doe" required="required" /> <br /> <label for="description">Book Description: <span class="required">*</span></label> <textarea id="bookdescription" name="description" placeholder="max 40 words describing your work, this will effectively be how you sell your bookto the reader" required="required" data-minlength="20"></textarea> <br /> <label for="synopsis">Book Synopsis: <span class="required">*</span></label> <textarea id="synopsis" name="synopsis" placeholder="max 100 words of the synopsis of your book,to the reader" required="required" data-minlength="20"></textarea> <br /> <label for="file">Filename:</label> <input type="file" name="file" id="file"> <br /> <label for="check_tc">Do you agree to the T&C<span class="required">*</span></label> <input type="checkbox" id="check_tc" name="check_tc" required="required" /> <br /> <input type="submit" value="submit" id="submit-button" /> </form> <?php $connection = mysql_connect("localhost", "root", ""); if(!$connection) { die("database connection failed: " . mysql_error()); } $db_select = mysql_select_db("good-read", $connection); if(!$db_select) { die("database selection failed: " . mysql_error()); } $sql = "INSERT INTO author (auth_first, auth_second, auth_email, auth_telephone) VALUES ('$_POST[fname]','$_POST[sname]','$_POST[email]', '$_POST[telephone]')"; mysql_query($sql, $connection); echo "1 record added"; $sql_book = "INSERT INTO book (book_title, book_num_pages, book_genre_id book_description, book_synopsis) VALUES ('$_POST[booktitle]','$_POST[genre]', '$_POST[numpages]','$_POST[description]','$_POST[synopsis]')"; mysql_query($sql_book, $connection); echo "1 record added"; mysql_close($connection); ?> any help would be much appreciated regards collie
-
php to view PDF in browser on all platforms
is their a way to view pdf in the browser that will work on all browsers and devices, is there any free versions online and if not what are the best paid ones. i have tried PDF.js but the problem i found it works well with one pdf, but i want to display so many pdfs on the web page, and when you click one it will then load it in the browser. thanx
-
margin left and right help(overlapping)
got it working with a list, thanx mteam www.davidcolligan.com/portfolio2.html just some style tweaks but got it sitting the right way now. thank you
-
margin left and right help(overlapping)
i forgot about you messaging me lol sorry, ill try that ul and lil first n see if that works lol.
-
margin left and right help(overlapping)
i tried that, but its still the same if i add more into the first one, i uploaded it again with more text so you can see what happens
-
margin left and right help(overlapping)
hi everyone working on my portfolio site, have my portfolio page designed and laid out the way i want the only problem i have is i have one piece of work floated to the left and another piece floated to the right but underneath which can be seen at www.davidcolligan.com/portfolio2.html . which looks fine, but i have a margin-bottom on the top portfolio piece but once i add more content to the top one it just overlaps the second peice of work, what is the best way to remove the margin-bottom and have it not overlap but just keep going on without interfering with the next portfolio piece any help would be great thanks collie
-
css help positioning boxes
hi everyone, working on my new portfolio page, and i have an idea in my head but it doesnt seam to look right the way i have coded it. the problem is that i have the skills used on recent websites ive created in rounded boxes, i can get them to pad out to the right, but once i have too many skills and they have to drop down to the next line, they just overlap each other. i have tried using margin's to stop this but it doesn't seem to be working. also after one portfolio section, i have another one directly under it, but i want spacing between them, i have tried the <br /> and margin bottom again. but it just sits on top of the first portfolios skills. the problems can be viewed at www.davidcolligan.com/portfolio2.html any advice or help would be much appreciated thanks collie
-
twitter jquery problem
Cheers elite I'll try that when I get home and let u know how I get on
-
twitter jquery problem
I know ur only helping, but don't see why u need my password. U could just tell me what to do
-
twitter jquery problem
I won't be givingout my username n password lol it should have nuttin to do wiv yhe widgets,
-
twitter jquery problem
tried that also lol, my tweets arent protected. this is annoying now lol
-
twitter jquery problem
i didnt want to create a widget? the script works wiv other usernames just not mine
-
twitter jquery problem
i done that, and the script still doesnt work,
-
twitter jquery problem
hi everyone, the problem im having is that when ever i put in my own twitter account "collie21" into the jquery code, it doesnt show up my tweets, but if i use someone else's it works fine, you can find the problem at www.davidcolligan.com this is the jquery code var tweetUsers = ['collie21']; var buildString = ""; $(document).ready(function(){ $('#twitter-ticker').slideDown('slow'); for(var i=0;i<tweetUsers.length;i++) { if(i!=0) buildString+='+OR+'; buildString+='from:'+tweetUsers[i]; } var fileref = document.createElement('script'); fileref.setAttribute("type","text/javascript"); fileref.setAttribute("src", "http://search.twitter.com/search.json?q="+buildString+"&callback=TweetTick&rpp=50"); document.getElementsByTagName("head")[0].appendChild(fileref); }); function TweetTick(ob) { var container=$('#tweet-container'); container.html(''); $(ob.results).each(function(el){ var str = ' <div class="tweet">\ <div class="avatar"><a href="http://twitter.com/'+this.from_user+'" target="_blank"><img src="'+this.profile_image_url+'" alt="'+this.from_user+'" /></a></div>\ <div class="user"><a href="http://twitter.com/'+this.from_user+'" target="_blank">'+this.from_user+'</a></div>\ <div class="time">'+relativeTime(this.created_at)+'</div>\ <div class="txt">'+formatTwitString(this.text)+'</div>\ </div>'; container.append(str); }); container.jScrollPane(); } function formatTwitString(str) { str=' '+str; str = str.replace(/((ftp|https?):\/\/([-\w\.]+)+(:\d+)?(\/([\w/_\.]*(\?\S+)?)?)?)/gm,'<a href="$1" target="_blank">$1</a>'); str = str.replace(/([^\w])\@([\w\-]+)/gm,'$1@<a href="http://twitter.com/$2" target="_blank">$2</a>'); str = str.replace(/([^\w])\#([\w\-]+)/gm,'$1<a href="http://twitter.com/search?q=%23$2" target="_blank">#$2</a>'); return str; } function relativeTime(pastTime) { var origStamp = Date.parse(pastTime); var curDate = new Date(); var currentStamp = curDate.getTime(); var difference = parseInt((currentStamp - origStamp)/1000); if(difference < 0) return false; if(difference <= 5) return "Just now"; if(difference <= 20) return "Seconds ago"; if(difference <= 60) return "A minute ago"; if(difference < 3600) return parseInt(difference/60)+" minutes ago"; if(difference <= 1.5*3600) return "One hour ago"; if(difference < 23.5*3600) return Math.round(difference/3600)+" hours ago"; if(difference < 1.5*24*3600) return "One day ago"; var dateArr = pastTime.split(' '); return dateArr[4].replace(/\:\d+$/,'')+' '+dateArr[2]+' '+dateArr[1]+(dateArr[3]!=curDate.getFullYear()?' '+dateArr[3]:''); }
-
Jquery slider
Hi everyone, was wondering if use could help, what is the best jquery slider that will allow both content and images Regards Collie
-
Best CSS3 framework
Whats the Best CSS3 framework to use and do yous use it on all your projects?
-
Wordpress contact form
Got it all working now
-
Wordpress contact form
Can anyone help I installed the contact form 7, but it won't send any emails, it keeps saying failed to send email, does anyone know how to fix this, or a better contact form that will allow me to setup multiple contact forms and use different email address
-
Wordpress posts on different pages
this worked, thanx alot man helpped me out a lot
-
Wordpress posts on different pages
How would this be done, and would they still show up on the main page or would it only be the one with the right category
-
Wordpress posts on different pages
It's not that I'm trying to do, what I'm trying to do is, have three separate pages that I can make posts too, like post on the home page, then post different content on a blog page, and then post different content again on a totally different page