Re: [PHP-DB] Display records on form

2005-01-04 Thread David Ziggy Lubowa
On Tuesday 04 January 2005 10:10, David Ziggy Lubowa wrote:
 Hey guys ,

  I was wondering , i have 16 records within a table in my Database , i have
 managed to have a form which can add and modify the records. My only
 problem is how i can display on a form when i search. Can someone give me
 heads up on how i can code this in php, to display the records in a tabular
 manner when i search.

sorry i meant 16 fields  not records : )

 Any help is highly appreciated.


 cheers

 -Z

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Display records on form

2005-01-04 Thread David Ziggy Lubowa





first of all , let me apologize for the top post, second let me apologize for 
not giving more detail.  The main problem is basically pagination , i have 
failed to add pagination code to my own code simply because it is not as 
simple as i thought.  Considering i am a begginer in PHP , i must give myself 
some credit for reaching where i am ,  as for code snippet here goes,


[snip]




html
titleIP Addresses/title
body

?php


  // Get the search variable from URL

  $var = @$_GET['q'] ;
  $trimmed = trim($var); //trim whitespace from the stored variable

// check for an empty string and display a message.
if ($trimmed == )
  {
  echo pPlease enter a search.../p;
  exit;
  }

// check for a search parameter
if (!isset($var))
  {
  echo pWe dont seem to have a search parameter!/p;
  exit;
  }




$link = mysql_connect(localhost, me,me2);
mysql_select_db(ip, $link);
$qry = mysql_query(SELECT * FROM IP_Addresses where free like '%.
$_GET['q'].%', $link);

?
table border=1 width=100%tr?php

if (mysql_num_rows($qry)==0 ) {

print  Oops No records found ;
?
br
a href=http://localhost/ipsearch2.html;Back/a
/br
?
exit();
}
if (mysql_num_rows($qry)  0) {
   for ($i = 0; $imysql_num_fields($qry); $i++) {
   echo td align=centerstrong . mysql_field_name($qry, $i) . 
/td;
}
}

?

/tr?php

if (mysql_num_rows($qry)  0) {
   for ($j = 0; $jmysql_num_rows($qry); $j++) {

   ?tr?php

   for ($k = 0; $kmysql_num_fields($qry); $k++) {
   echo td align=center . mysql_result($qry,$j, $k) . /td;
   }

   ?/tr?php

   }
}

?
/table
br
br
a href=http://localhost/index.html;Main Page/a
br
br
a href=http://localhost/ipsearch2.html;IP Address Search/a/br/br
/br
/br
/body
/html


[/snip]


i had posted some time back that i have problems with pagination and got alot 
of help , but the problem is i have never known how to put the code together 
with what i have .. any help is appreciated...


cheers





















On Tuesday 04 January 2005 04:17, Jochem Maas wrote:
 David Ziggy Lubowa wrote:
  On Tuesday 04 January 2005 10:10, David Ziggy Lubowa wrote:
 Hey guys ,
 
  I was wondering , i have 16 records within a table in my Database , i
  have managed to have a form which can add and modify the records. My
  only problem is how i can display on a form when i search. Can someone
  give me heads up on how i can code this in php, to display the records
  in a tabular manner when i search.

 how does somebody manage to create a working script to insert/update
 data in a table and not be able to figure out how to output a simple
 HTML table listing the current records?
 I mean, do you want us to teach you how to write PHP? (My rate is
 40euros/hour)

 --
 Sorry David but your email shows little to no effort on your part to:

 a, define you problem succinctly
 b, show context (e.g. code,SQL snippets)
 c, show that you have made a decent effort to work the problem.

 given those facts you can consider yourself lucky to recieve any replies
 at all.

 ANYWAY... seeing as I'm bitchin' at ya I might as well give you a small
 clue

 the process, roughly speaking is:

 1. do a SQL select query. (e.g. SELECT id,name FROM mytable)
 2. loop thru the result, for each row output some HTML for a table row
   e.g.

   echo '
   tr
   tda href=/edit.php?id='.$row['id'].'edit/td
   td'.$row['id'].'/td
   td'.$row['name'].'/td
   /tr'
 3. don't forget to add begin- and ending TABLE tags.


 try googling 'display a MYSQL result set with PHP':
 I came up with:
 http://juicystudio.com/tutorial/php/mysql.asp
 (which is pretty funny cos the guy wrote a tutorial on mysql/php on an
 ASP based site!!)

  sorry i meant 16 fields  not records : )

 whether you tables has 16 rows or fields seems to me to be completely
 irrelevant.

 Any help is highly appreciated.
 
 
 cheers
 
 -Z

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Pagination

2004-12-16 Thread David Ziggy Lubowa


Hey guys, 

  I am working on an internal db and i have a script[below] which does some 
searching for me, now i am no expert in php but atleast i can always read up, 
i want to add some kind of pagination because just incase i search for 
somethign in particular i dont want it to display 100 entries on my form, how 
can i incorperate a pagination script in the script below, 

all help is highly appreciated

[snip]


?php

  $var = @$_GET['q'] ;
  $trimmed = trim($var); 

// check for an empty string and display a message.
if ($trimmed == )
  {
  echo pPlease enter a search.../p;
  exit;
  }


$link = mysql_connect(localhost, beef,b33f);
mysql_select_db(ip, $link);
$qry = mysql_query(SELECT * FROM IP_Addresses where free like '%.
$_GET['q'].%', $link);

?
table border=1 width=100%tr?php

if (mysql_num_rows($qry)==0 ) {

print  Oops No records found ;
?
br
a href=http://localhost/ipsearch2.html;Back/a
/br
?
exit();
}
if (mysql_num_rows($qry)  0) {
   for ($i = 0; $imysql_num_fields($qry); $i++) {
   echo td align=centerstrong . mysql_field_name($qry, $i) . 
/td;   echo td align=centerstrong . mysql_field_name($qry, 
$i) . /td;
   }
}

?

/tr?php

if (mysql_num_rows($qry)  0) {
   for ($j = 0; $jmysql_num_rows($qry); $j++) {

   ?tr?php

   for ($k = 0; $kmysql_num_fields($qry); $k++) {
   echo td align=center . mysql_result($qry,$j, $k) . /td;
   }

   ?/tr?php

   }
}

?

[/snip]

cheers

-Z

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Cisco UBR interface with PHP

2004-11-24 Thread David Ziggy Lubowa
On Friday 19 November 2004 07:53, Doug Finch wrote:
 I have an idea that I wanted to throw out there.  I have a cable ISP
 plant that I am trying to help with a project.  They are using Cisco
 7114 UBRs to connect their cable modems with their Internet backbone -
 this device assigns it a dhcp address and associates it with the modems
 MAC address.  It does a lot more than that but that is all I am
 concerned with.  I want to see if I can write a script that will
 constantly execute the command show ip arp which will return the
 current routing table with the MAC and IP address (dhcp).  I can foresee
 two problems so far, one is that you have to have enable mode access to
 run this function and two, I would fear creating a security loophole by
 running an enabled function all of the time.  Can I get your thoughts on
 this?

wouldn't something like Perl Expect work wonders here?? you could combine it 
with a mysql db if the details are to be stored for later viewing.

-Z

 thanks,
 Doug

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php