php

Database Structure Advice Needed

Hey Guys, Im currently working on a site which will contain a products catalog. I am a little new to database design so I'm looking for advice on how best to do this. I am familiar with relational database design so I understand "many to many" or "one to many" etc (took a good db class in college). Here is an example of what an ite...

JQuery not loading on first page visit

Hi all, Im having an issue loading the JQuery library when I visit my webpage for the first time.. therefore none of its functions work...If i visit another page on my site, or reload it , the script works and continues to from there on... and to recreate the issue, I have to clear my cookies....I have checked my code and it seems fine...

html post form action not specifically spell out php file?

I have a post html form, and the action is index.php, which is the websites main page. I never actually have index.php in the address bar, since links to "/" go to it, and even if I did, it would be website.com/home(/), since I use rewrite rules. So basically, the user should never see index.php. However, the form submit doesn't work if ...

Bug in a PHP regex

I am trying to print "1" if there are at least two of the same figure in the match, else 0. What is wrong in the regex? if ( max ( array_map ('strlen', preg_split('/([0-9])[^0-9]*\1/', "1 2 3 1 4") ) ) == 1 ) echo 1; else echo 0; ...

What would PHP bring to the table for a Java Developer ?

I am a Java EE developer working mainly with JSPs, Servlets, and frameworks like Spring. Will learning PHP be a wise decision ? What would PHP offer me ? ...

how to resolve symfony doctrine:build-schema error (Unknown relation alias table_name)

how to resolve this symfony error : C:\inetpub\wwwroot\project\trunk\preprod\signup>php symfony doctrine:build-schema --trace >> doctrine generating yaml schema from database [sfException] Unknown relation alias table_name Exception trace: at C:\inetpub\wwwroot\project\trunk\preprod\signup\lib\vendor\symfony\lib\plugins\sfDoc...

SimpleTest Mock objects: clearing expectations

The short question: Is there a way to reset a Mock object in SimpleTest, removing all expectations? The longer explanation: I have a class that I'm testing using SimpleTest and am having some problem with the Mock objects it is using. The class is a Logger, and inside the logger are a number of Writer objects (FileWriter, EmailWriter,...

Confirm Password?

New to all this so forgive my ignorance. I am trying to figure out how to add a "confirm your password" field to my form. Using PHP and mySQL. Is this entered in the html form code, and how can you set it to auto check that the password and confirm password fields match. ...

MySQL: Join Query Across Multiple Databases Located on Different Servers

In SQL Server there is a way to join tables from multiple sql servers by using link tables. I wonder whether is it possible to do the same? I am using PHP, does PHP provides this kind of facilities? ...

Preserving previous while adding new one on a form

I have this form that comes with some parameters from another page. I want to preserve those values and add a sortby parameter, but every time I hit submit all the parameters disappear, but the new sortby parameter. How can I preserve the parameters from the previous page and add or change just the orderby parameter. <form name="formSe...

Using a MySQL trigger to update all fields matching a condition

Hi, What I am trying to do is to set the column of each insert query to the latest value of $i I've never used a trigger in MySQL before but I do believe that's the easiest way to do this. I would be open to other ideas and suggestions. Right now I have: $i = 1; foreach($_FILES["upload_project_images"]["name"] as $key => $name) { ...

Simple MySQL query question

How would I do this (the part in square brackets): $name = 'Bob'; mysql_query("INSERT INTO table(field1,field2) [ select value of field1 from another table ], '$name'"); ...

How session and cookie works?

When i create a session variable where is saved username and password, how does it works internally? Same question about regular cookies where information is saved. Which type of information are included in coookie and session? What is the difference between them? ...

Unique ID SQL Buddy

What is the best way to create a unique id column for table records in SQL Buddy? I am new to all of this so excuse the ignorance. Is there some sort of auto number generator or something? I am assuming that the php script will check the table and insert the next number or something. Again, I am learning right now after using Caspio for ...

how to edit/manage multi tiered conditional data in php

I have 4 tables in a mysql database that i need to add/edit/manage. The difficulty, is that each one, is dependent on the one before it. The way i have this setup on the user end, is you select an option from table 1. You are then presented with the options in table 2, that have the first option's ID in their row. Once you select optio...

cakePHP validation

I am working on a cakePHP project and have set up my data validation. The problem i have is that i keep getting an error from the core/model of cakePHP. The error is: Notice (8): Undefined offset: 0 [CORE/cake/libs/model/model.php, line 2435] if (is_array($validator['rule'])) { $rule = ...

PHP - QuickForm Submits as Get Rather Than Post

I am trying to get started with PEAR's HTML_QuickForm but I'm having a problem. For some reason all of my form data is being submitted with GET and not POST. The default is supposed to be POST and I've tried setting it explicitly. The only thing I've been able to figure out is that when I simply call display() on the form it works cor...

How are these 2 lines of code different?

Can someone tell me in really slow terms the difference between these 2 lines of PHP? $hassh = base64_encode(sha1($word)); $hassh = hash(’sha1′, $word); ...

Problem with dynamic SVG image generation

Hi Guys, I am trying to write a server side script (PHP) for generating an SVG image based on user input. I am using the following code: <?php echo '<?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"&gt; <head><meta http-equiv="Content-Type" conten...

Why isn't this PHP parsing XML correctly?

I am attempting to parse Yahoo's weather XML feed via this script. The parsing itself works: I am just struggling with getting the days to correspond with today, tomorrow and the day after. The final HTML output looks like this: Which can be seen here: http://www.wdmadvertising.com.au/preview/cfs/index.shtml todayMon______________19 ...