Hi guys,
I'm punching way above my weight for mySQL Queries and syntax right now. I could do with some help achieving the following:-
I have a metrics/analytics table with country of visit in a row. I have the following query:-
SELECT `country`, COUNT(`ip`) AS `cViews` FROM `metrics` WHERE `projID` = 'projID' AND `country` != 'XX' AND...
I want to have a small text box with a scroll bar that will hold frequent outputs from PHP based on server-side activity. How do I set up formatting like this?
...
Okay, so I have this form that is set to preload a DB record for editing if you add a ?edit=1 to the url, it will load record #1 for editing into the form. I have a box that is like this-
<select class="field select addr">
<option value="no"<?php if($row['has_amenities'] == "no") {echo ' selected=\"selected\"'; } ?>>No</option>
<o...
Hi,
I am working on a directions service where users enter the from and to addresses and get the directions table ( that gives turn by turn information ) along with a map showing the route.
Below is the complete source code ( getdirections.php ):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtm...
Can anyone see anything wrong with this login script:
public function login($username, $pass, $remember) {
// check username and password with db
// else throw exception
$connect = new connect();
$conn = $connect->login_connect();
// check username and password
$result = $conn->query("select * from login w...
function procLogin($username,$password){
$query = "SELECT *
FROM members
WHERE login = '".mysql_escape_string($username)."'
AND passwd = '".mysql_escape_string($password)."'";
$result = mysql_query($query);
//$values = array();
while($row = m...
Ok, so as the title says, I have an HTML page that I fetch using libcurl (cURL inside PHP).
That page has one <form> that I need to extract the <input> names and values, and I would like to do that using Regex.
I'm making it using Regex because I think that's the easier way. If you think I shouldn't use regex, but something like xpath, s...
So I have these tables:
Topics
id, title, date
Posts
id, title, text, date, user, topic_id
How should I structure it so that the first post, the topics text, is on top of all other posts in the topic? Sort them by date? Or is there a smarter way?
...
I want to conditionally output HTML to generate a page, so what's the easiest way to echo multiline snippets of HTML in PHP 4+? Would I need to use a template framework like SmartyPants?
echo '<html>' + '\n'; // I'm sure there's a better way!
echo '<head>' + '\n';
echo '</head>' + '\n';
echo '<body>' + '\n';
echo '...
I have a dedicated server and I'm in need for building new version of my personal PHP5 CMS for my customers. Setting aside questions whether i should consider using open source, i need your opinions regarding CMS architecture.
First approach (since the server is completely in my control) is to build a centralized system that can support...
I recently had an idea to create my own String class to make using PHP's functions easier. Instead of strlen($str) I write $str->length(). Makes it easier to remember parameter orders in certain functions, like substr.
I ran some timing scripts on it and found that it's about 5 times slower than using the regular functions. I haven't te...
I am getting the following error on my site, however, i don't know what I am to do. I know I am missing something, however, I just can't figure it out.
You can see what I am trying to achieve here: 4.6.4. Zend_Application_Resource_Session
Fatal error: Uncaught exception 'Zend_Db_Table_Exception' with message 'No adapter found for Zend...
Thank you one and all for your patience and help. I am completely restating the question because it is getting quite long from all my revisions.
I have an PHP MVC framework with 4 entry points:
from the root:
index.php
index-ajax.php
admin/index.php
admin/index-ajax.php
I needed a .htcaccess file that would take any request and rewrite...
Hello all,
I am returned the following:
<links>
<image_link>http://img357.imageshack.us/img357/9606/48444016.jpg</image_link>
<thumb_link>http://img357.imageshack.us/img357/9606/48444016.th.jpg</thumb_link>
<ad_link>http://img357.imageshack.us/my.php?image=48444016.jpg</ad_link>
<thumb_exists>yes</thum...
I have mutliple workers SELECTing and UPDATing row.
id status
10 new
11 new
12 old
13 old
Worker selects a 'new' row and updates its status to 'old'.
What if two workers select same row at the same time?
I mean worker1 selects a new row, and before worker one updates its status, worker2 selects the same row?
Should I SELECT and UP...
Anyone knows how Invision Power Board makes their urls like the following?
index.php?showuser=349
index.php?showtopic=83
index.php?showforum=9
and just pages:
index.php?act=register
index.php?act=about
and so on. How they do it? I'm sure they don't do it like i do now:
if (isset($_GET['showtopic'])){
include('viewtopic.php');
else if...
Hello,
I'm making a hit counter. I have a database and I store the IP and $_SERVER['HTTP_USER_AGENT']; of the visitors. Now I need to add a filter, so I can put away the hits, that are made by bots. I found out, that many bots usually keep some common words in the $_SERVER['HTTP_USER_AGENT']; , so I's like to make and array of words, th...
I'm trying to write php script that would:
connect to mysql
create database
create user and password
add user to database
import prepared sql file to database
The thing is that it'll be on shared host (and I'm trying to make it universal and work with different hosts). I guess database and db user will be prefixed with my account nam...
There seems to be a bug in a Wordpress PHP function that leaves whitespace in front of the title of the page generated by <?php echo wp_title(''); ?> I've been through the Wordpress docs and forums on that function without any luck.
I'm using it this way <body id="<?php echo wp_title(''); ?>"> in order to generate an HTML body tag with...
Can I use PHP with Oledb connection?
As far as I know database connection as provided by PHP extension are all odbc.
...