PHP Variable Table Length
-
So there’s a table that is holding a few strings. However, each time a string is added, the table grows. I want to retrieve the total length of the table, or find out how many variables are in said table, and convert it into an integer to use in a for loop. Thoughts?
Code so far, tell me if I have any other issues, hopefully you all can understand what I am trying to do. Using WooCommerce store on a MySQL database. And the data is being stored in my post meta.
for($i = 0; $i < *length of team_name table*; $i = $i + 1)
{
if ( team_name = get_post_meta( $i, ‘Team Name’, true ))
{
wc_add_notice( __( ‘Please enter a new team name.’ ), ‘error’ );
break;
}
}
The topic ‘PHP Variable Table Length’ is closed to new replies.