Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Creating Directories From MySQL Query


I'm trying to create a subdirectory within a directory. The directory uses $rows['link'] from the category table, and the subdirectory uses $subcategory2 from the subcategory table. The directory that gets created is always based on the last record in the table, rather than the parent.

I have tried using another query, but only the subdirectory gets created then......




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Creating Directories In Directories
I'm building a document management system and I've hit a snag. I'm relatively new, so this might be obvious to someone else.

A user can add folders into the system (kinda like Windows Explorer) and then add folders IN those folders. I have a database set up to track the child/parent relationships but I'm having trouble with the actual creation of the directory on the server.

I pass the "add folder" script the NAME of the new folder as well as the PATH of the new folder. If I'm in the root directory and I add a "TEST" folder I pass "TEST" as the folder name and "" as the path, because we're adding at the root.

If I've added "TEST" and I want to add "IN TEST" inside the "TEST" folder I send "IN TEST" as the new folder name and "TEST" as the path. My code then adds a "/" and calls mkdir. So the path passed to mkdir is "IN TEST/TEST". Code:

MySQL Creating Links From Query
As I am still learning PHP could someone tell tell me how to achieve the following?

Display only the first four records from a sql query and have 'next page' links and number of pages so users can navigate the next four records and so on. The usual navigation you find on search engines.

I have the query and the num_rows function, I just need to know how to implement it.

Creating Directories With PHP
Can you create directories and text files with php?

Creating Directories After Root
i want to create directories using vaiables my mkdir line is as follows PHP Code:

Creating Multiple Directories
I'm trying to simultaneously create two directories. From a form, the user will be prompt to name a directory and from there the PHP code will create the directory that the user named. When that direcotry is named I am trying to create another directory with the directory that was just created. Is this possible? Here is my code:

Warning: Pg_query() Query Failed: ERROR: Directories: Permission Denied
I've ran into a wierd problem with my script, and i'm quite dumfounded. I'm doing a PHP interface to create directories into a filebank. The idea is that the directories are virtual, they don't truly exist in the server. The directory names are saved into a PostgreSQL table, in quite simple fashion.

The wierd problem is that i get the following error message when i try add the directory name into the database:

Warning: pg_query() query failed: ERROR: directories: Permission denied. in /var/www/html/okartek/inc/class_psql.php on line 50

The sql is done by a class, called by this function: PHP Code:

Creating The Query On The Fly
I'm trying to create an UPDATE query string based on results from a foreach loop. My concern is how to deal with commas for multiple array values - PHP Code:

Creating A Date Range Query?
If I have a date field, and want to select all records that are older then 30 days from today, is there a way to query MySQL for this? Code: $todaydate=date("Y-m-d");

$query = "SELECT * FROM members WHERE joined_date = '$todaydate-30' "; I know this will not work, but it's functionaly what I am trying to do.

Creating A Faster Mssql Query
I have a series of tables that I need to sort through. meaning get one peace of info from one table to get the next peace form the next table and so on. My problem is I only know how to write the code to do it in that order. Code:

Creating An Hyperlink From A Sql Query Image
I have an sql query that pulls an image filename out and displays that image.

echo "<img src='/images/thumbnails/{row["Filename"]}' width='75' height='50'>";

I have another images folder with the larger pictures, they also have the same filename. What I'm trying to do with no success! is for the thumbnail image displayed from the query be an hyperlink to a blank page and display the larger image.

Creating Temporary Table From Full-text Query
i'm using a full-text search on my db which works fine, but now i'm working on filtering the results further, like products in range of prices. my logic is to simply SELECT them out of the temporary table, only if it would be created. i don't think i need to paste any code since i think you get the idea.

Creating Dynamic Hyperlinks With User Id's In Php Query
Im dabbling with PHP and trying to write a new search.php file to scan for specic users in my dating website and then display the users along with individual links to their profile.

$profile = $row["id"];       -- this field takes profile ID from mysql database
The profile field pulls in an ID field from a mysql database for each record. I need to integrate this fields value into the hyperlink when the results are returned so it has a list of all users each with an individual hyperlink to their profile. Then users can click and access the profile of a specific user. Code:

PHP Update Query Mysql: Query Succussful?
I can't seem to successfully test an update query. Below is a piece of code that updates a statistics table. If row today doesn;t exist, a new day must be created. But this doesn't work...

thank you for your reply.

$today= date("Y-m-d");

$qq="update totals_r set hits_r=(hits_r+1), lang_$lang=(lang_$lang+1), cat_$cat=(cat_$cat+1), rating_$rating=(rating_$rating+1), bussite_$bussite=(bussite_$bussite+1) where date='$today'";

$result_6 = mysql_query ("$qq");

if (!$result_6){ /// IF !ROW_TODAY ==> CREATE NEW DAY

$qq_2="insert into totals_r (hits_r, lang_$lang, cat_$cat, rating_$rating, bussite_$bussite, date) values(&#391;',&#391;',&#391;',&#391;',&#391;','$today')";

$result_6_2 = mysql_query ("$qq_2");

if (!$result_6_2){
$err_msg_sql_6= mysql_error();
$err_loc_6="$PHP_SELF"." // Query6: update totals_r";
}
}

Creating XML From Mysql
I am trying to pull data from an MYSQL table. Right now I am only getting the first record out because I am not using a check array. Here is my code, I have been bashing my brains in all day over this hopefully someon can shed some light on this. I tried a basic array earlier and it didn't work. Code:

Creating A New MySQL Database
I run a small horse racing based website that has a 'fantasy league' type competition each season. Last year i looked after all the entries, leaderboards etc.. using excel and copying and pasting to webpages each week.

However this year i am going to attempt to use MySQL and PHP to have it automatic bar result entry. I have built a basic php and MySQL site before with the usual insert, edit etc.. But this one will need features im not sure how i go about making.

Basically there will be a list of horses (around 150) divided into 4 grades. Entrants pick 2 horses from each grade so a total of 8 horses. Winning horses score 5, 2nd = 3 and 3rd =1.

I was thinking of having the following 2 tables - one for the horses - listing their name and grade. One for entrants - the peoples contact details and their chosen horses.

However from there im not sure how to able to enter the latest results and how i can create a leaderboard page and list the points each horse has. I was thinking of a new table with a row for each result showing horse name and points scored but i then dont't know how this table can be used to create a column on the horse table that lists each horses total points. And also how it can be used to create the total points each entranant has got so far (i.e. the total point for all 8 of their horses)

Creating Mysql Table
I have PHP script that creates a mysql table. My problem is when I goto the following php page to access the table it says "missing table 'table name'" I look in phpmyadmin and its clearly there. Eventually after refreshing the page like ten times it detects and works. Do I have to reconnect the mysql connection or something?

Creating Variable Using Mysql And Php
I am trying to create a variable but it just will not work. Anyone
see the error?

<?
$query = "SELECT Name FROM dataAA WHERE
NameId='".mysql_real_escape_string($_GET["Id"])."'";
$result = mysql_query($query)
or die ("no can do.");
while($row = mysql_fetch_array($result))
{

$Name = "echo $row["Name"]";
}
?>

Creating Table Using PSP And MySQL
Ok, so Ive overcome the first hurdle of connecting to MySQL and MyDatabase on my
web server using PHP scripts. Now I want to create a simple table with 3
fields. Don't have a clue where to start using PHP.

Creating A Mysql Dbase Via Php?
I was wondering if anyone could tell/show me how to create a mysql database via a php script as my hosts do not support telnet(dont ask).

Creating A PHP/MYSQL Scheduler
I am trying to do is create a schedule that will block off times that are already booked, as well as color code a small calendar depending on whether there are AM or PM openings. I managed to create a working edition, but I took the easy route of making the time in 30min intervals and creating a column for each time (0800, 0830, 0900, etc) in the DB.

Now I need to create it allowing ANY time to be booked for ANY interval. I have an idea as to what needs to be done, I am just not sure how to go about doing it.

What I set-up was a table with the technicians names and times they can work that day. It simply had a column for name, column for start time (datetime field) and column for finish time (another datetime field).

Then I had a bookings table with many columns for different fields to do with the booking, but it also had a field for the name and start/finish datetime columns.

What I think I need to do is run a query first to grab the time range that someone is available that day. Format it somehow into a PHP array. Then look at the existing bookings and find the time free between the booking and the available hours using PHP. Display a color if there is availability in the AM, PM, or both.

Then I need to create an HTML table to display the bookings and free time based on the DB info to allow creation of new bookings. Can anyone provide some guidance who has done something similar or would know how to do it? I just need the base of finding the free time between bookings and available hours and displaying a table with such info.

PHP, MYSQL With Creating Waitlist
Would anyone have any suggestions as to how to set up a waitlist? Here is what I have:
A user goes on to my site and registers for workshop. They are offered a list of open workshops or they can be waitlisted for workshops that are full.  What would be the best way to structure this? I currently have 3 basic tables:

users
register (transaction info that connects users to workshop, has timestamp)
workshops (info about each workshop, date, time, cap, etc.)

My idea was to have an "order" field in the register table that would renumber itself every time someone registers or changes registration, but I am having difficulty with this renumbering. I was thinking I could use this order field to tell if someone's order has changed.  So for instance, I cap the workshop at 5 people, and 6 people are registered.  The 6th person is actually on a waiting list. 

Then someone drops out of the workshp and now that 6th person is the 5th person and is no longer on the wait list.  I could create some php code that said, if the person's old order field is 6 and the new order field is 5, then send an email "you are registered!"  That is what I am trying, but I am having difficult storing the old value and then renumbering and finding the new value.

Creating A MySQL Table
I'm trying to create a table in PHP.  I can use phpmyadmin to do it but I can't create it in PHP.  I even copied the code generated in phpmyadmin and it still didn't work.  Here is the code:

Creating Link To From A Mysql Row...
I have the following code:

echo "<td>" . $row['title'] . "</td>";
I want it to link to $row['url'].

I have tried multiple methods, but I seem to be missing something.

PHP Saying Error In Mysql Syntax, But Written My Mysql Query Browser!
I have a basic db that I access with MySQL query browser. Everything
seems fine to me but I am using this db as part of a php shopping
basket and when I try to add an item I get:

Notice: Query failed: You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near '>function.extract]: First argument should be an
array in functions.inc.php on line 31
Notice: Undefined variable: price in functions.inc.php on line 36
Notice: Undefined variable: price in functions.inc.php on line 39
Notice: Undefined variable: total in unctions.inc.php on line 39

I'm assuming the last three are caused by this problem as price should
be passed to the cart, and total is worked out using it. However
although I know mySQL code it was the MySQL query browser that
actually generated the code and I cannot see a way to view or debug
the code.

The db has one table in it which is made up of id, name, subname,
desc, and price.

The code in the php file that is being referred to is:

Creating Search Engine In Php And Mysql
I want to create a search option for my site (ONLY searches my pages, NOT a web search).
A lot like the one on these forums actually. I was just wondering if anybody who has done this before had any suggestions as to how I should go about doing it.

Is it possible just using php and mysql... or would I need to use some other type of language (to make the spider). Or do I even NEED a spider for something like this?
Here is how I think it could be done. I'd have 2 columns. One for the location of each page on the site. Another would have text from the page (perhaps the first 40 words on the page).

From there, I could have my searching script compare the search value against anything the text column. if it found the search value in the text column it could display the link in the results page, with the text from the page to serve as a description.

Problems Creating Database MySQL In PHP
Hello, here is an interesting problem: I can connect to MySQL and create there normally databases via command line. The problem is when I want to create a database in PHP, I have problems apparently with the configuration of username and password in MySQL. I have PHP 4.3.9 as a module Apache2. and MySQL 4.1. I repeat, I can connect normally to MySQL in PHP, using mysql_connect() with the right hostname, username, password values. but when I write a script to create a database in PHP, it has these problems. This is the simple script:

Creating A Tree And Storing It In MySQL
I'm wanting to create a tree structure and store this in a database, which can then be retrieved and displayed. I'm looking to implement this with PHP and MySQL. From what I gather it is possible using a table with two or three columns: ID, Parent_ID, Description.

So if we start from the top, the leaf would have an ID of 1, and a parent_id of 0. An item down the tree would have an ID of 2, and if a child of the first, a parent_id of 1, and so forth. How would I extract this from the database? Would I get all the data and then manipulate with PHP? Presumably I need to use some kind of recursion(another thing I'm a little shaky on).

PHP Code/libraries For Creating MySQL Databases
I am working on a registration system, and one of the things I am going to
need to be able to do it setup the database tables for each event that I
have registration for. Normally I would do this by hand, but I am wondering
if there are any code libraries out there that could generate the SQL for
me.

Basically I would have a list of column names and types. I know I could
just foreach() through the list, with a switch to divert control to the
different code segments depending on the column type, and at the end I would
have the SQL generated.

This seems like the sort of thing that somebody might have done before and
released a code snippet for. Maybe in PEAR DB? Any ideas?

Problem Creating A Mysql Database Named M#2 Using Php
I am serving a website using apache. All the php and mysql code I have
written works, except for one thing. When I try to create a database
named M#2 using the following call, no database is created.

$db = 'M#2'
$query = "create database '$db'";
$result = @mysql_query($query);

I am able to create a database just fine using this technique when it
is named other things (such as M$B, or Global1). I am able to create
the database using CocoaMySQL. The MySQL documentation I read says the
only characters you cannot use are , . / and , but they don't mention
"#". Also, it mentions that if you can have any database name that can
be used as a directory name. I am able to create a directory name in
unix called "M#2".

Creating .xls And .doc Files With Page Breaks Using PHP / MySQL
Our company currently processes a few hundred form submissions through
our site. Up till now, the contents of the form has been sent to our
customer support staff in real-time. Each submission goes to a general
e-mail box where it's printed through our mail client. A copy of the
form is also stored in a MySQL db, although it's not used that often.

I have been asked to figure out a way to stop delivering the form
submissions in real-time and migrate to the following:

Each morning, provide an Excel spreadsheet and word document (or PDF)
with a certain number of form submissions to each customer support
rep. For example, say 200 form submissions were processed the day
before. This morning, I should split those 200 among the 5 support
reps and provide each of them a certain amount (which can change
daily). Assuming each person gets 40 form submissions, each person
would need to be given an excel file and .doc document that contains
their 40 form submissions.

One of the most important things is that the .doc file needs to have
each form submission separated by a page break, so that when they
print the document each form submission is printed on a separate page.

Finally, not all of the fields from the form submission should be
given to the support rep. Maybe date and time is left off.

Help In Creating Data Entry Forms With MySQL
I was wondering if any of you experts has some example of MySQL data
entry form either using PHP or any public domain software for my photo
album. I'd like to enter some description with it.

Query MySql Using PHP
I've created my first search form and it seems everything is working pretty well. However, since I am very novice in scripting in general, I'm having one problem that I can't seem to unearth an answer to. Perhaps someone could easily offer the answer:

my query asks to select a 2 char state code or a 5 digit zip code in order to obtain results desired. In testing, if I enter a state code, it brings up only the state requested. However, when I enter a zipcode, I get the wrong results. I'm sure its the "LIKE" that is throwing this off. Here is the query portion of the script:

$result = mysql_query ("SELECT * FROM fish_dealers
WHERE Zip = ´$Zip%´

OR State LIKE ´$State%´
");


Can anyone give me a clue?

Mysql Query
I have wrote a Select statement, that checks if the user and password and returns a value, however can i add something to the statement that would allow me to get the userID from the table users, so that i can write the value to a cookie, is it possible. PHP Code:

MySQL Query
I want to have a field where I store a list of what categories that
particular row falls under, I don't know which format to do or how I
would query it.

For example, row1 might belong to categories 1, 3 & 7 - I'd want to be
able to query all rows belonging to 3 and get row1.

AND And OR In MySQL Query
I've build a query from a php form where people van select more results for a cell wich can only contain one value Here's my query:

SELECT * FROM person WHERE color_eye = ('brown') OR color_eye = ('black') AND color_hair = ('Blonde')

Everything after the "OR" will be ingnored. So how can I tell MySQL I want all the brown and blacked eye?? Without the AND it works fine, but in real the query is way longer with multiple AND's.

Mysql Query
I have a code that installs some tables into a mysql database. Heres the code, but it keeps coming up with the error "Install failed (ID 1)" I have tried tons of things, even looking at other installers and mimicking them, but nothing. PHP Code:

Php/mysql Query
I want to display the users name on the pages when they have logged into my site. i have done it one way that is to take what they type in the login form and post it on the page and that works fine. only one problem and its more of a preference than a problem but the way i did it takes exactly what they type say "username" and posts that so if they type "UsErNaMe" it will post it like that. i want to show the name exactly as they make it when signing up. im guessing i have to query the data base... mine being MYsql. PHP Code:

Mysql Query
How can I get rownum using MySQL queries ,
In Oracle one can you in this way SELECT rownum as srno, fname FROM
tablename
suppose If there are 45 records and if i use while for the

srno should display 1, 2, 3, ... 45

query like SELECT rownum as srno, fname FROM tablename

I dont want to use php counter, i want it from query

Mysql Query
I'm running a sports pool and I'm trying to display stats from the
results of the picks.

The table is 'results' and the fields are 'pick_number', 'game_number',
'user_id', 'points' and 'date'

There is one record for each users' pick. 0 points are given for a loss
and 1-4 points are given for a win. I've already created a query that
gives me the top players by overall points but I'd like to expand that
to include the number of points won just this week, overall winning %
and winning % this week. Can I do this in one query and then display in
an HTML table?

$query = "SELECT user_id, SUM(points) AS points FROM results GROUP BY
user_id ORDER BY points DESC";

Mysql Query
1) i have a database divinelive_messages table with a sessid column
2) i need to find out rows from the database, which only show that sessid in there once.

Mysql Query With * And +
im trying to return all results that come from or went to certain extensions on our phone logging system but i don't want to return any that have a src or dst that contain a * or a +. This is the where statement i have that is not working Code:

Getting MySQL Query
I took some info out of my database.  I want to display an error page if their are no rows in the database.  How would I go about doing that. I have this:

$query = I execute my query here.  Taken it out so you don't connect to my database Muahahahhaah

$row = mysql_fetch_row($query)

if ($row == '')
{
echo 'Their is nothing in the database!';
}else{
echo 'Yes, the database does home info in it.';}

What would I put to make this work?

MySQL Query
Whats wrong with this query:

SELECT from, subject, message, time FROM user_messages WHERE username='$username' ORDER BY timestamp DESC

I get this error:
QuoteYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from, subject, message, time FROM user_messages WHERE username='Drezard' ORDER B' at line 1

MySql Query
I'm having some difficulty formulating  query that will allow me to retrieve the details of a specific user in the database. The user's information is stored in one table called Users and another called UserProfile. Both tables are linked by the UserID field.

My current query returns a Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource and my knowledge of Mysql is not great(Still learnng)

Here is my code:

Need Help With Basic Php Mysql Query
$z = "goodBMW"; the word goodBMW is no where to be found in in the table times. but it will echo every single row thats in that table and it doesend sort between Group 1 and Group 2 where the hell is my query wrong.

Problematic MySQL Query
Would anyone be able to help me with the following MySQL problem. I am
trying to extract all of the users who are not on vacation for a given
date. I am using a NOT IN statement, however, I need to have a more
advanced query than a simple one. What I need to do is as follows
SELECT users.user_id,...

MySQL Query Quandry
I have a simple need to go into a 4 column table and based on the content of the first 3 print the content of the 4th. In other words if column1 = a, column2 = b, and column3 = c then print "dog" from column4. This will be the action for a short form that allows the user to make 3 choices that will determine a link. I have this from another script that I'm trying to modify:

mysql_select_db('search_links');
$query = "select * from links ";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
echo '<p>Number of books found: '.$num_results.'</p>'
for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
echo '<p><strong>'.($i+1).'. Title: '
echo htmlspecialchars(stripslashes($row['type_prop']));
echo '</strong><br />Author: '
echo stripslashes($row['area_code']);
echo '<br />ISBN: '
echo stripslashes($row['price_range']);
echo '<br />Price: '
echo stripslashes($row['saved_link']);
echo '</p>'
}

The above query prints the entire table and I would like a query that limits to the form choices indicated above.

PHP: MySQL UPDATE Query
I need to have a page where the user can update his info and/or delete his record. I haven't tested the DELETE query yet.

When I open the page it shows all the info stored in the database. When I change something and hit the update button I get the message that the record was successfully updated, but nothing really hapens.

If you want to see what's happening go to URL , click on the 'directory' link
The user ID is 'scooby', and password 'dooby'. If it does not work, try the following combination: user ID: 'sunny', password: 'trout' . Then click on the 'edit profile' link and try to change something and see what happens. I am attaching a php file of the 'edit profile' page, the one I am having trouble with so you can see the entire code.

Getting Variable From Mysql Query
what's the best way to set a variable = to a result from a mysql query?


Copyright © 2005-08 www.BigResource.com, All rights reserved