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




How To Access And Modify And Add Records In MySQL Table From A Windows Client?


The MySQL table is located in a Linux Server OS, so I need the
information from that table for updating Paradox tables in Windows OS.
If a PHP program in the Linux Server can save a file with the
information I need, can I make a PHP program in Windows OS to get the
saved file or even better, to access the table in the Linus Server OS?...




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Control Access To Specific Mysql Records For A User
I am just trying out a php form, when posted submits data to database. The system is we allow everyone to submit the form. As administrator I can view and edit the records. But whoever submits the form should be a registered user and he should be able to only view his records but not edit.

Having Trouble Looping Through Records In A MySQL Table
I'm having some trouble looping through the records of a MySQL table using PEAR DB. Here is my code:

$navigationSql = "SELECT * FROM nav";
$navigation =& $db->query($navigationSql);
while ($navigation->fetchInto($nav)){
define("NAVIGATION", "<a href="$nav[2]" target="$nav[3]" title="$nav[1]">$nav[1]</a><br />"); }

The when I enter:
print NAVIGATION;

into any of my PHP scripts it should loop through the stuff in table named nav, but it is only displaying the first record and so far everything I've tried does not seem to make it loop through all of the records in the table and I can't figure out why not.

How To Modify Records With A Button Or Check Box...?
I need some help creating a "modify / update records" page. Something that will grab a record and allow the user to post information into the fields that haven't been filled yet.

I already have my create record page, I just don't know how to make a modify page. I'm also not sure if I should use checkboxes to select the record then modify on a different page or just allow the user to modify on the same page.

The theory behind the worksheet is a person enters the customer name and date the contract is created. When we get confirmation, the person who received the confirmation enters the date it was received, the person who received it and who it was credited to.

Count,sort,diplay Number Of Records In MySQL Table
I am designing a search engine using PHP/MySQL and I am logging all search terms into a MySQL table. I was wondering how I count the number of occurences of a term in the table, and then sort and display the terms in descending order. For example, if the column in my table with search terms looked something like this:

clothes
casinos
clothes
homes
homes
clothes

How can I count and order the records so that I can display according to how many times they appear, like so:

1. clothes(3 entries)
2. home(2 entries)
3. casinos (1 entry)

Automatic Delete From MySQL Database Table Expired Records?
I have a question . . .

how can i delete from MySQL database table automatic expired records ?
?

One think is to make a service that deleting the expired records . . .

Any other method ?



Get Windows Client Login
I have to create an intranet website by php, sql server and IIS.
One requirement is to get the user name from the windows client login.
I'd like to know if it is possible, and if yes how?

I think it should be possible by asp, but in php?

Client Filesystem Access
I want to deliver subscripted content to users on CD. They then place
the CD into their CD drive and navigate to my site. Once logged in, I
want to be able to draw content from the CD and incorporate it with
content from my server.

I understand that access to the user's filesystem is not normal or even
allowed by default. However I am wondering if there is a workaround to
this limitation.

In Javascript, I can offer the user a security certificate that, if
acknowledged, will allow me to access their filesystem. Is there
something like that in PHP?

MSSQL - Unix Client / Windows Server
I need to access a MSSQL 7.0 database on a Windows NT Server from a Linux PHP Web-server.
I have looked at FreeTDS, unixODBC and iODBC. unixODBC seems the easiest but alas one need to buy licenses. iODBC is a bit slow, apart from the ODBC part containing many connection layers, it also has a request broker/client running on top of the ODBC.

FreeTDS seems like a decent solution. It even has the option of using TDS in conjunction with iODBC. This eliminates the use of the extra request broker/client. Furthermore I've read somewhere that one can use the Sybase functions of PHP to connect to a MSSQL server since both use the TDS (Tabular Data Stream) Protocol. What method would be the easiest and/or could be implemented using the ADOdb database abstraction layer class?

Php Session Problems When Working With A Windows Client Program
I am currently involved in a project that involves a windows client
program written in delphi and a web application written in php. I
have made several php pages for the delphi program to do requests via
the http component from INDY. the problems I am having are:

1) the first request from delphi app to php web app is the
authenication. In which user sends username + password to the php app.
If authenication is valid, a session is started and the sid is
returned to the client. All subsequent requests from delphi app to
php web app will have this sid as one of the arguments in the POST
form request (this is one of the function in the INDY component for
delphi). Even the sid is passed to the subsequent pages, the session
global array is still undefined. However if I open up a web browser
and create my own string request to the login page then the next page,
the global array would be defined (using var_dump + echo to see the
array) what is the problem?

2) does the above problem has anything to do with the http referer
field?

3) this problem that I am having has been asked before on google
group, but somehow the person who asked it didnt' put down the
solution for it. (this only involves the web only) when I login on a
page and return with a session id, then I log out.. the user is
redirected to the login page again. However if the user login again
(with a different login account), he would be presented with the same
session ID as before. a different sesson id is presented only if the
user restart the browser. why is that happening?

Random Records From Access Database ?
I am retrieving records from an access database in php.But i want to select random 7 records....how can it be done ?

Restricting Access To A Records Contents
I have a table called Reports . These are reports of different users . Now if 2 users attend a meeting, they each make separate reports which get stored. When a third user attends another meeting on the same subject, he creates a third record.

I have been fiddling around with ways of updating records such that a single report can be updated by all 3 users. But it results in even a 4th user being able to view the report (if not update) and i just dont know how i can limit this.  The issue here is that a situation can arise when the 4th user may need to read the report but until the time he needs to, i dont wish to allow access to that report. Code:

Displaying # Of Records In A Table
Can anyone throw me a link to some prefab code, or a tutorial on how I can get a page to display the number of records that meet a certain criteria.

example:
I have a page that stores information on audio FX. I'd like to include a feature that would let the users know how many items are in a particular section.

Player (10)
Items (5)
Weapons (0)
etc.

All help appreciated,

Counting Records In A Table
Ok, I am trying to count the number of records in one of my tables. Seems simple. BUT! its not working. It returns a 2 no matter how many records are in there.

Heres the code.

<?php
$sql = "SELECT count(*) from cam";
$result = mysql_query($sql);
?>

I would think this would work.
I have also tried mysql_num_rows, and max(), and sum()...
a little help would be appreciated, and why is it returning a 2?

AJAX To Display New Records In A Table
Instead of refreshing the entire page to show the new fields in a
table, I was wondering if it would be possible to use AJAX to display
the new records in a table.

For example:

Messages are entered into the DB. I use PHP to create a table that
displays the messages.

Instead of refreshing the entire page to show the table with new
messages, how can I use AJAX to show the new messages in the table
without refreshing the entire page?

Counting The Number Of Records In Table
I want to count the number of records which apply to a repeating id field. (the user id remains the same, but their are several records which relate to the user. I want to know how many records in the table exist for a specified user id) Does anyone know a function for doing this?

Linking Multiple Records From Another Table
I'm not sure I'm even thinking about this the right way, but here goes:

I have a table of users. Each one of these users may be associated
with none, one, or many records in another table I call a todo table.
table user = 'id', 'name', 'bla bla bla','todo_list'
table todo = 'id','title','other info'

Suppose user 'id=1253' has on his todo list items 756,241, and 672. I
create a string 756,241,672 and store that string in the user's
todo_list field. Then when I want to display the todo items I get the
string with a query, bust it up into an array, iterate the array and
query the todo table.

I have a gut feeling I'm making it way more complicated than need be.
But I can't think of any other way to do it

Table Join Count Records.
got my counting records script just the way I want it, now I've read all the posts on Joins, and read the manual and mysql.com.... but can't seem to get the right number to come out.

I have two tables: table1 & table 2

table one has a field called ID and field two has a field called relID (this is the link between them) I want to count all of the records in table two where the relID is equal to the table 1 ID field. I thought this would do it, but the number it returns is wrong:
PHP Code:

Copy Select Records To New Table
In the table Step I have multiple records for each given id. I want to save the current list of records for an id to a new Step_Old table so I can look back at what I had at a given point in time, since the records for an id in the Step table will change over time.

Now the question... does anyone have a slick way to do this, or do I need to Select all the records I want to save and then save them one by one with a while loop into the Step_Old table?

Displaying Records In A Split Table?
trying to split up results of a query into a split table. example: PHP Code:

Checking $_POST Against Records In Table
I have a table containg name, description, url which contains many records When I submit a new form, I want it to check the url fields in the table and check it against what I have posted. Therefore something like

$check_table = function here to get all urls

if($_POST['url'] == $check_table) {
return false;
} else {
return true}

However, how do I get all the urls and get it to check each one?

MSSQL Access Via PDO And Windows ODBC
I'm running a "Windows Server 2003" with "MS SQL 2000" IIS and PHP5.1 as
test environment for my project. I would like to access my MSSQL-Server
via Windows ODBC and PDO. I created a System DSN an i enabled the PDO
extension in my php.ini. But the following code snippet keeps failing:

<?php
try
{
$DB = new PDO("odbc:LocalServer");
}
catch (PDOException $e)
{
echo $e->getMessage() . "<br>";
exit;
}
?>

Here is the error message:

"could not find driver"

Send Mail From Windows Without Access To Php.ini?
I've found example on how to send email using PHP on Windows 2000. However they
all say to set the outgoing SMTP server address in the php.ini file in the
Windows system directory.

That's a problem for me because I intend to upload this to my hosting company's
server, where I do not have access to the system directory. Each user on this
system has their own virtual mail server.

Is there a way to specify the mail server in the script itself?

Registry Operation In PHP(Need To Read Some Windows Registry Key On Client Machine)
Are there any Registry function available in PHP for reading the
registry key on the client machine(WindowsXP,Win2K).(I don't need any
write operation to the registry).

I need to do certain validation for some application on the client
machine by reading the registry entry created by some other external
application(.exe).

Table Name In Ms Access Database
I'd like to know how can i get and store the table names of an ms access database. I use odbc_result_all but i don't know how to exctract and store information about the table name.

MS Access And Php- Insert Row In A Table
I am not able to insert a row through a form in my database which is in Access.Please see my code below and help..Select works O.K. but inserting through form is a problem.This is form1.php.here I am inserting the values.This form has action process.php......

Insert Into Microsoft Access Table Using ODBC
The following lines of code don't return an error but they also do not insert the row into the database:

$SQLText="Insert into member (MailingID, MemberID, [File As], EMail, LetterID, AudienceID, DateSent, Sent) Select $MailingCode, $row[0], '".$row[5]."', '".$row[6]."', $LIDToInsert, $AIDToInsert, '".$DateSent."', 1;";

print '<br>'.$SQLText;

$rs_upd=odbc_exec($link, $SQLText);

if (!$rs_upd) die("Couldn't update database");

I've tested the resulting $SQLText string in Access directly and it works find there so this must be a PHP or ODBC issue.

Grab Content From HTML Table And Place Into MySQL Table?
I am in the process of helping a co-worker upgrade some of his old static html pages into dynamic MySQL driven pages. He currently has a lot of pages with huge tables displaying data. Does anyone know if there is a script or class that can convert a table to a .sql file for upload?

Table Background Color Based On Results From MySQL Table
I am trying to get the "Did User Agree" field on a database query to be colored Green for "Agreed" Red for "Disagreed" and Blue for "Agreed (2nd Time)" .. I have my PHP setup to do the query just fine as of right now with alternating column colors, just can't seem to get the colors to work as I am hoping for.  Can anyone help me get the Agreed? table's background color to the colors above? Code:

Mysql Fetch_field Gets Table Alias, Not Real Table Name
After a SQL 'select .... from tablename alias'
the mysql_fetch_field function returns a value $result=>table which
will contain the alias, not the actual table name.
Is there a way to get the actual table name ?

I am running mysql 4.1 and php 4.4

Using PHP To Sort Data In MySQL Table 1 By Values In Table 2
I have a MySQL database with 2 tables in it. products and prices.. Products has a field in it called 'prodno'. Prices has a field in it called 'prodid'.

There is one of each item in products and each product has it's own unique 'prodno'

There are multiple instances of each product's pricing in prices.. One for each price.. So if a product had multiple prices depending on quantity it would have an entry for each price.. Example:

id = 1
prodid = 7001
qty = 300
price = 12.5

id = 2
prodid = 7001
qty = 400
price = 15.5

I was wondering if I could query the database getting info from the products table but sort it according to the prices in the prices table.

Kinda like doing a "SELECT * FROM products" ordering it by the lowest price value from each item..

This is all very confusing to me, and I'm the one writing it. Let's try one last time..

Query the database selecting * from products (I plan on using all the info in products) and ordering them by the lowest price for each item in the prices table. I've tried sorting the results of just a basic SELECT * FROM products using Javascript and PHP but with pagination in the results it makes it a bit hard.

Mysql Command Line Client
Is there any way of making the mysql command line client full-screen?
Sometimes it's easier to use the client than go thru php, but
since it's only about 80 characters wide that limits its usefulness.

PHP/MySQL Records Per Row
Is there any way to have the records pulled from a mysql database display like this in a table:

record1 | record2
record3 | record4

etc: I've been thinking about this for about three months and have yet to come to a good solution.

MySql 4.1.1 Password Problem - Client Can't Connect
Environment:

Sun servers running solaris 2.8
Php 4.3.6
Apache 1.3.29
Mysql 4.1.1
phpMyAdmin 2.6.0-alpha1
phpAds 2.0

PhpMyadmin and phpAds don't succeed to connect the MySql database when
we put a password
(for any user and host).

When we remove the password (put it blank), it's working : they can
connect the Mysql database.

We updated from MySql 4.0, so we were thinking that it was a password
problem.
We have also started the server with the --old-passwords command.
Still no luck.

So, we tried to keep the old passwords first (short hash), short
column (16) as importing the
mysql database from MySql 4.0. They didn't succeed to connect.
After we launch Mysql-fix-privileges, the password column became wide
(41) and we tried to put
short and long password
in it with the followings commands :

for long passwords : UPDATE user SET PASSWORD=PASSWORD('mypass')
WHERE user='user' and host='host;
FLUSH PRIVILEGES;
for short passwords :UPDATE user SET PASSWORD=OLD_PASSWORD('mypass')
WHERE user='user' and host='host;
FLUSH PRIVILEGES;
PhpMyadmin and phpAds didn't connect either.

Client Does Not Support Authentication Protocol MYSQL
Just thought I would post a solution (temporary at best, but a solution at
least.) for all those using PostNuke who have upgraded MySql to 4.1. I have
had problems with PostNuke logging into MySql after upgrading to MySql 4.1.
I received the message:

"Client does not support authentication protocol requested by server.
Consider upgrading MySQL client."

After reading here:
http://www.mysql.com/doc/en/Old_client.html

And here:
http://www.mysql.com/doc/en/Password_hashing.html

* I simply edited my startup script for MySql Server on my box to launch
with:
mysqld_safe --old-passwords

* Restarted my MySQL server

* and then changed my MySQL passwords with the OLD_PASSWORD function rather
than the previous PASSWORD function.

It solved my problem. I was able to create a new site database and all was
well!

How Do You Delete Records From Mysql
Could someone please show me how to delete records from mysql. Maybe even an example in a loop that deletes records based on a criteria.

How Many Records Can MYSQL 4.1.14 NT Via TCP/IP Can Hold?
how many records can MYSQL 4.1.14 NT via TCP/IP can hold?

how many records per table can MYSQL 4.1.14 NT via TCP/IP can hold?

how many records in a table can MYSQL 4.1.14 NT via TCP/IP can hold given the table has a field Primary key - BIGINT(20) autoincrement?

need your opinion..Here are the facts:

MY system is an internal one. My Server--Is only a Desktop.. Celeron 2.8 Gigahertz, 40Gig Baracuda HD, 512 MB memory.. And it serves an average of 20 users a day and it also serves me for my system development..The average records inserted per month on mYSQL is 10,000 records..We foresee that system would be used for about 10 years.

Counting Records In MySQL
I've been trying to write a page that checks the database and counts the number of records and if the number is less than 3000, it loads page X, but if the number is equal to 3000, it loads page Y.

I know this should be a simple if/else statement but it's the checking and counting that I cannot get to work. 

Can't Update Date Field - Mysql Client Version 5.0.33
I am trying to update record and date field, but it fails although my timestamp echos perfectly.  I don't know what to do:  my sql client version is 5.0.33 and the model table has got date filed which is model_date. Code:

How Do Iterate Through MySQL Records And Displat Them?
Basically I have a page where a person can choose from a list of stories posted by people, or they can choose to submit their own. I've managed to do the page where they can submit their on. The way i did this was to set up a mySQL database, and table in the database called stories. I then made an id (primary key), author, title, body and date field in the table. When the user submits their story its given an id (which increments on each submition) and their author, title and body fileds are sent to the database. The date key is automatically stamped in.

Ive also managed to have the submition page display what they submitted by using the count(*) function, their story would be the last to be submited , so it pulls that from the database and displays it.

Now what I want to do - on the page where they can pick a story, is have the page connect to the database and grab each record and display the author and title on the page next to a radio button. And have the id for the story in a hidden field or variable so when the user to chooses a particlar story it uses the id to grab the story from the database.

So how do iterate through all the records in the database, and display each one?

Problems Updating Records In MySQL With PHP
Sorry to ask what is probably a simple answer, but I am having problems
updating a table/database from a PHP/

PHTML file. I can Read From the Table, I can Insert into Table/Database, But
not update. Here is a copy of the

script I am using. I do not know what version of MySQL my host is running
nor do I have Shell Access to it. I

would like to setup a script so my website users can update thier records
without my intervention.

Also you may send replies to stevennyoung@yahoo.com

Begin Script

<?php
$db = mysql_connect("localhost", "username", "password");
mysql_select_db("databasename",$db);

if ($id) {
if ($submit) {
$sql = "UPDATE tablename SET
EMail='$EMail',Username='$Username',Password='$Pas sword',Item=

'$Item',Price='$Price',URL='$URL' WHERE Username='$Username'";
$result = mysql_query($sql);
echo "table Updated.";
} else {
// query the DB
$sql = "SELECT * FROM tablename WHERE Username='$Username'";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
?>
<form method="post" action="<?php echo $PHP_SELF?>">
e-Mail Address:<input type="Text" name="EMail" value="<?php echo
$myrow["EMail"] ?>"><br>
Username:<input type="Text" name="Username" value="<?php echo
$myrow["Username"] ?>"><br>
Password:<input type="Text" name="Password" value="<?php echo
$myrow["Password"] ?>"><br>
Item:<input type="Text" name="Item" value="<?php echo $myrow["Item"]
?>"><br>
Price:<input type="Text" name="Price" value="<?php echo $myrow["Price"]
?>"><br>
Item URL:<input type="Text" name="URL" value="<?php echo $myrow["URL"]
?>"><br>
<input type="Submit" name="Update" value="Update table">
</form>
<?php
}
} else {
// display list of articles
$result = mysql_query("SELECT * FROM tablename",$db);
while ($myrow = mysql_fetch_array($result)) {
printf("<a href="%s?Username=%s">%s %s</a><br>
", $PHP_SELF,
$myrow["Username"], $myrow["Item"], $myrow

["URL"]);
}
}
// Close DB Connection
mysql_close()
?>

Grabbing Specific MySQL Records
I have set up a target page to pull information out of a mySQL database to populate the page. The problem is that it is only pulling from the first record and not the record specified. What do I have to do to pull from a specific record? I am using Dreamweaver MX to administer the site on WinXP using PHP if that information will help.

PHP Mysql Outputting Records Repeatedly.
I have not messed with php/mysql in a while and have come up with a
problem I have run up against before but cannot remember the solution.
See the following page:

Very Slow MySQL SELECT Query After 11 Records
I have a very weird problem

I moved my database to new IIS 6.0 + PHP 4.3 + MySQL 4.0 setup. I tried to check with myphpadmin if everything works fine, but I couldn't browse my table (125 records). I used SELECT option and found out that SELECT query up to 11 records is ok, but after that, even if I choose to limit query to 12 records, it just hangs.
I tried selecting from the beginning of the table and from the middle - same thing, but when I run query localy on mysql console, everything works fine

How Do I Prevent Mysql From Printing Redundant Records?
I have a very urgent question. I am using php and mysql.
Say I have a database full of names and email addresses. I want to do a query that when you type in the name or partial name, mysql will only show a name once, even if it is in the database 200 times. Then I want to click on that name and have mysql show the 200 email addresses associated with that name (which I know how to do). See below:

Inserting Master-detail Records In Mysql
how I can insert a master-detail record in mysql? I use an auto-increment key, but I don't know how I can find that key for inserting the detail records, I tried to make a 'highest-key' function with 'select MAX(field)...' but in php it gives the wrong key (in mysql it gives the right one).

Changing Data In Objectified Mysql Records
I am using this very slightly modified function found here:
http://us2.php.net/mysql_fetch_object
to make mySQL rows into objects of type $classname:

// This takes db result rows and makes real objects of $classname type
function &buildObj($result, $classname) {
while($row = mysql_fetch_assoc($result)) {
if ($row === null) return null;

/* Create the object */
$obj =& new $classname;

/* Explode the array and set the objects's instance data */
foreach($row as $key => $value)
{
$obj->{$key} = $value;
}
$objs[] = $obj;
}
return $objs;
}

This is called by a retrieve: function:

function retrieve($where) {
echo $query = "SELECT * FROM $this->table WHERE " . join(' AND ',
$where);
$result = mysql_query($query);
$rows =& buildObj($result, get_class($this));
mysql_free_result($result);
return $rows;
}

The problem I am encountering is that if I do this in my script:

$listing = new Listing;
$listings = $listing->retrieve(array('row > 1') );
foreach ($listing as $aListing) {
$aListing->address='xxxxxxxxxxxxx'
}
foreach ($listing as $aListing) {
print_r($aListing);
}

The value in $aListing->address is unchanged.

However if I do this:

$listing = new Listing;
$listings = $listing->retrieve(array('row > 1') );
foreach ($listing as $aListing) {
$aListing->address='xxxxxxxxxxxxx'
$newArray[] = $aListing;
}
foreach ($newArray as $aListing) {
print_r($aListing);
}

I see the update values in $aListing->address .

Break MySQL Records Into CSS Columns Automatically
I'm making a page of links, each assigned a category. There are two tables - "favourites_links" and "favourites_categories". This is how the links currently appear:

Category 1 Name
Link 1
Link 2
Link 3

Category 2 Name
Link 1
Link 2
Link 3

What I want to do is break my page into columns. Basically, set a number of columns (e.g. 3), count the total records, and work out how many records to show per column. Each column should be enclosed in a <div class="column"> wrapper, which floats to the left. Code:

Displaying Priorty Records And Normal Records In The One Dataset.
I have a page which displays the records from the database and uses paging to display the records in groupes of 10 per page.

I now want to be able to show results depending on the database field (display) in the database (can be set to either "full" or "limited"). If the record and the field display is equal to "full" i want to then display this record at the top of the record set and display all the fields.

If the record is equal to "limited" i want to display different results and they must show after all the records which are equal to "full". I can't output two different recordsets as i use paging and only want to show 10 records per page. Code:

Can I Convert MySQL Db Records Into Microsoft Word Documents?
i found the solution to export
file from mysql db into *.csv. but is there anyway to convert the
contents into *.doc and save in my webserver and providing a link for
the end users to download the word file?

FYI, the database records are obtained by end users submitting the
forms themselve and i saved it in my db...


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