php

Problem in SQL query from PHP

I have a table qotwVote1a with fields QuestionId, MemberId, Vote1a where QuestionId and MemberId are the primary key. I want to run a query to find that a member, has voted for a question or not. If not, I set the variable $j to 0, if yes I set it to 1. I wrote this query. But it is giving me an error. Can someone have a look at it? A...

PHP & Postgres: View vs. SELECT, when to use a view?

Related to my previous question: PHP and Databases: Views, Functions and Stored Procedures performance Just to make a more specific question regarding large SELECT queries. When would it be more convenient to use a View instead of writing the SELECT query in the code and calling it: $connector->query($sql)->fetchAll(); What are the ...

Numbers and calculations in php/sql

ok im new on the scene with php and sql, i read the basics and was able to produce a DB driven shoutbox. This is my website http://www.teamdelta.byethost12.com/ What i want to do next im not sure what i should be using java? php? sql? i have no idea... but i assume php and sql if sql can do what i think it can.. What i want to do next i...

PHP - Weird characters when disabling error reporting

This is basically all I'm doing echo @file_get_contents("http://******.org/ti.php?i=".$i."&s=".$s); But when I remove the ti.php file from that server to test if it hides the error I get this in my browser where the error would be:  What the hell is that (lol) ? I've never seen it before and can't think of an explanation of ...

PHP-Retrieve content from page

I'd like to retrieve a page's content and reformat it to my liking... For example: Go to example.com Get content within tags with class "x" Pass content to specific variables Spit out the content in some pretty form..array, csv, xml... Not too hard, right? I'm a PHP noob! :) ...

Is using multiple php includes a bad idea?

I'm in the process of creating a php site. It uses multiple php classes, which are currently all in one php include. However, I am using aptana IDE, and the file is now starting to crash it (its around 400 lines). So I was wondering whether there would be any negative impact of including all the files seperately. Current: main file: i...

Currency Conversion for E-commerce site - Preventing incorrect Total Cart due to rounding

I'm adding multi-currency support to an e-commerce application. The way I approached the problem was to keep the application in it's base currency and have the template call a priceDisplay() function/plugin anytime it displays a price. So the template continues to receive prices in dollar amounts. The priceDisplay function correctly conv...

can i do caching with php?

I have read a few things here and there and about PHP being able to "cache" things. I'm not super familiar with the concept of caching from a computer science point of view. How does this work and where would I use it in a PHP website and/or application. Thanks! ...

How do i split $_SERVER['HTTP_REFERER'] to get the base url?

I have $_SERVER['HTTP_REFERER'], pretend it is http://example.com/i/like/turtles.html . What would i need to do to get just the "http://example.com" part out of the string and set into its own variable? ...

How to search another site using PHP

Good Morning and Happy Friday! A client wants his site to link to another site for the purpose of searching that site's database. What's the best way to do this using PHP and/or Joomla? Thanks! ...

RSS Feed Problems?

Now I am using custom permalinks in WordPress for my posts and pages but when I try to set an RSS feed for each individual post or page the RSS feed dosen't display the feed it only displays the current web page. It seems that the home page feed is the only one that works which doesn't use custom permalinks. Here is the code to display a...

PHP Syntax Error

I get the following error: Parse error: syntax error, unexpected T_STRING in /home/www /mariam.awardspace.info/php/pageCen.html on line 87 The code that generates the error: $rows=mysql_num_rows($result); print "<table border=1>\n"; print "<tr><th>Avatar</th><th>E-mail</th><th>Comments</th></tr>"; for($i=0; $i<$rows; $i++) { ...

Fatal error: Cannot use object of type mysqli_result as array in /home/william/public_html/forums/index.php on line 228

Why won't this work? I keep getting that error. // Setup forum topics, post count and last post xxxxx $query = array( 'SELECT' => 't.subject', 'FROM' => 'topics AS t, pbb_forums AS f', 'WHERE' => 't.last_post_id = f.last_post_id'); $result = $forum_db->query_build($query) or error(__FILE__, __LINE__); ...

MySQL random rows sorted by a column name

Original Question: I am currently using Zend Framework with Zend_Db_*, and I am selecting three random rows from a table: $category->getTable()->select()->order(new Zend_Db_Expr('RAND()'))->limit('3') Where $category is a Zend_Db_Table_Row. I would like to grab three random rows, but have those three rows ordered by the column named ...

How safe is it to send a plain text password using AJAX?

Maybe the title is badly phrased but couldn't think of a better way of saying it. I am working on a login system at the moment (nothing formal, just experimenting) and was planning on using PHPLiveX (an AJAX library) for some features. Basically you create some PHP functions which are then called via JavaScript. You can add parameters (...

PHP web application installation

I've just finished a web application written in PHP. I thought it was as easy as compressing my .php files and dumping my database in order to decompress those files in the "production" server, creating the database structure and database user, but it doesn't work. Several php files have include directives that are not working, I was usi...

Gmail,Yahoo, Facebook, Twitter contacts importer in PHP

Which is the greatest, cheapest application in PHP that I can buy to import Gmail, Yahoo, MSN, Facebook, Twitter contacts from my user's accounts if they wish to invite their friends? I have gone through: http://www.improsys.com/importer.htm http://www.octazen.com/demo.php and http://www.iplussoft.com/product/iplusinvite_pricing Octaz...

Why does this simple php script leak memory?

In hopes of trying to avoid future memory leaks in php programs (drupal modules, etc.) I've been messing around with simple php scripts that leak memory. Could a php expert help me find what about this script causes the memory usage to continually climb? Try running it yourself, changing various parameters. The results are interesting....

How to send product data to Amazon.com?

Does anybody know how to use PHP to send product data to Amazon.com? I want to create a custom app that sends product data from an ecommerce website to Amazon (to list products on Amazon). I can't find any info on this. ...

How to set a cookie with a php script thats executed by Flash?

I have a flash upload script, that uses a .php file as the processor. I need the processor file to set a cookie with a gallery ID that was created by php script, and pass it on to the confirmation page. Except when Flash runs the php file... it doesnt set the cookie. It does set the session variable, which was good enough, but now Im usi...